zoukankan      html  css  js  c++  java
  • selenium+phantomjs渲染网页

    from selenium import webdriver
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

    dcap = dict(DesiredCapabilities.PHANTOMJS)

    #dcap["phantomjs.page.settings.userAgent"] = ("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36 QIHU 360SE")
    dcap["phantomjs.page.settings.userAgent"] = (random.choice(agents))
    dcap["phantomjs.page.settings.loadImages"] = False
    #dcap["phantomjs.page.settings.disk-cache"] = True
    dcap["phantomjs.page.customHeaders.Cookie"] ='xxxxxxxxxx'

    #driver = webdriver.PhantomJS(executable_path='C:\Python27\phantomjs.exe', service_args=['--load-images=no'],desired_capabilities=dcap) #或者把phantomjs放在任何一个是环境变量文件夹的里面。
    driver = webdriver.PhantomJS(executable_path='/home/yangdefeng/Downloads/phantomjs-2.1.1-linux-x86_64/bin/phantomjs',service_args=['--load-images=no'],desired_capabilities=dcap) #linux版本的需要修改phantomjs文件的权限,chmod u+x phantomjs,否则报错peimission delined


    高并发 https://zhuanlan.zhihu.com/p/25507989

    https://thief.one/2017/03/01/Phantomjs爬过的那些坑/

  • 相关阅读:
    算法之路——插入排序篇3:希尔排序
    对enum的探讨
    算法之路——插入排序篇1
    算法之路——快速排序
    算法之路——插入排序篇2
    圆的角度DDA算法初试
    解决omnicppcomplete显示"pattern not found"
    汇编
    直线的dda算法
    equ定义的是符号
  • 原文地址:https://www.cnblogs.com/ydf0509/p/7340599.html
Copyright © 2011-2022 走看看