【发布时间】:2019-02-06 19:38:23
【问题描述】:
我正在尝试在 linux 服务器上运行 webscraper。完整的错误如下
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-141-generic x86_64)
我在 stackoverflow 上看到过类似的问题,解决方案是包含“--headless”和“--no-sandbox”参数。但是,我已经在这样做了。
我可以在本地运行此代码,但是我无法使其在服务器上运行。
我还检查了一切是否都是最新的,并且一切都是。
ChromeDriver 2.10.267518
selenium 3.141.0
这是发生错误的代码sn-p。
options.add_argument('--headless')
options.add_argument('--no-sandbox')
caps = DesiredCapabilities.CHROME
caps['loggingPrefs'] = {'performance': 'ALL'}
driver = webdriver.Chrome(options=options, desired_capabilities=caps, executable_path='/usr/local/bin/chromedriver')
我也尝试在没有 executable_path 选项的情况下运行上述代码,但仍然遇到同样的错误。
【问题讨论】:
-
你的chrome驱动版本好像太旧了,请问你用的是哪个版本的chrome浏览器?
标签: python selenium google-chrome selenium-webdriver selenium-chromedriver