selenium.Phantomjs设置浏览器请求头

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 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.23 Mobile Safari/537.36" )

driver = webdriver.PhantomJS(desired_capabilities=dcap)

driver.get("http://m.iqiyi.com/v_19rrmmdbkg.html")

driver.get_screenshot_as_file('01.png')

driver.quit()
posted on 2016-12-17 16:37 Kilichko 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Yemilice/p/6192590.html

你可能感兴趣的:(selenium.Phantomjs设置浏览器请求头)