首页 > 其他 > 详细

爬虫-Chrome-问题1

时间:2018-05-30 17:17:27      阅读:211      评论:0      收藏:0      [点我收藏+]

ChromeDriver设置headless参数就会出现未知错误,,非得设置参数--no-sandbox;原因待查,找了好久,供参考.

 

cited from stackoverflow

I was having the same problem on centos7.1 because I was the root user, and it was resolved after adding the code chrome_options.add_argument(‘--no-sandbox‘)

here is my code

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument(‘--no-sandbox‘)
chrome_options.add_argument(‘--headless‘)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get(‘https://www.google.com/‘)
print driver.current_url
driver.quit()

爬虫-Chrome-问题1

原文:https://www.cnblogs.com/wdmx/p/9111873.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!