码迷,mamicode.com
首页 > 其他好文 > 详细

爬虫-Chrome-问题1

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

标签:having   tps   add   www.   就会   adl   resolved   class   sel   

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

标签:having   tps   add   www.   就会   adl   resolved   class   sel   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!