selenium chrome如何设置收费代理
来源:9-3 chromedriver不加载图片、phantomjs获取动态网页
慕丝8011162
2017-07-28
老师你好, 下面代码是PhantomJS的收费代理设置示例
请问如果用Chrome如何设置收费代理,谢谢~
dcap = dict(webdriver.DesiredCapabilities.PHANTOMJS)
daili_url = 'proxy.xx.com'
daili_port = '8123'
authHeader = 'MYH-AUTH-MD5 sign=dsf5412x&app_key=123kjsdfxxlk3'
dcap["phantomjs.page.settings.userAgent"] = ('Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36')
dcap["phantomjs.page.customHeaders.Proxy-Authorization"] = authHeader
args = ['--load-images=false', '--disk-cache=true', '--proxy=http://{}:{}'.format(daili_url, daili_port)]
browser = webdriver.PhantomJS(service_args=args, desired_capabilities=dcap)
browser.get("http://www.0bad.com")
print (browser.page_source)
browser.quit()
1回答
-
bobby
2017-07-31
062017-08-04
相似问题