python selenium chromedriver headless+proxy模式下获取页面为空的解决方案
2018-10-27 00:13
369 查看
获取页面返回的结果全是
[code]<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>
解决方案:
[code]from selenium.webdriver import DesiredCapabilities from selenium.webdriver.chrome.options import Options from selenium.webdriver import Chrome ... options = Options() options.add_argument("--headless") # 无界面 options.add_argument("--disable-gpu") # 禁用gpu options.add_argument("--proxy-server=127.0.0.1:8080") capabilities = DesiredCapabilities.CHROME.copy() capabilities['acceptSslCerts'] = True capabilities['acceptInsecureCerts'] = True driver = Chrome(executable_path="your path",chrome_options=options,desired_capabilities=capabilities)
阅读更多
相关文章推荐
- chrome浏览器爬虫崩溃,怎么办?python + selenium + chrome + headless模式
- Running Selenium 'headless' with Chrome Driver in Python - YouTube
- selenium webdriver 之 Chrome -headless set proxy 暨 自动化测试中无头谷歌浏览器设置代理
- Liunx环境下python使用: Headless chrome + Selenium + ChromeDriver搭建
- Selenium-webdriver 页面模式在实际项目中的实际运用,大量Page页面如何初始化?
- Python - selenium自动化-Chrome(wap模式)
- Selenium自动化测试Python五:WebDriver设计模式
- python 爬虫日志(12) selenium+chromeheadless
- Python_selenium之获取当前页面的href属性,id属性,图片信息和截全屏
- windows,mac,linux如何配置python+selenium+chromedriver
- 构建Python+Selenium2(2=WebDriver)自动化测试环境<二>:IE、Chrome和Firefox运行
- Python3-Selenium3使用PO设计模式(Page Object)实现简单的页面登录操作
- python3 selenium 获取JS动态页面title
- win7 python3.6+selenium3.8.1运行chromedriver提示“Message: 'chromedriver' executable needs to be in PATH
- Selenium + Headless Chrome with Python3
- python-selenium(webdriver)中的自动截屏并获取验证码的位置
- Python_selenium之获取页面上的全部邮箱
- python中selenium结合chrome操作浏览器,并解决chrome与chromedriver版本不匹配问题
- 关于selenium2(webdriver)自动化测试过程中标签页面或者窗口切换的处理解决方案
- selenium+python自动化87-Chrome浏览器静默模式启动(headless)