【发布时间】:2020-02-23 07:11:35
【问题描述】:
我似乎无法让 Chromedriver 与 Ubuntu 一起使用。我在 AWS (EC2) 上运行 Ubuntu。我检查了/usr/bin,发现里面有以下包:
chromedriver
chromium-browser
所以,我的代码如下:
options = Options()
options.binary_location = '/usr/bin/chromium-browser'
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("--remote-debugging-port=9222")
driver = webdriver.Chrome(executable_path='/usr/bin/chromium-browser', chrome_options=options)
而且,我收到以下错误:
Traceback (most recent call last):
File "test.py", line 40, in <module>
driver = webdriver.Chrome(executable_path='/usr/bin/chromium-browser', chrome_options=options)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/chromium-browser unexpectedly exited. Status code was: 1
如果我检查我当前的 Chrome 浏览器版本,我发现我使用的是 78.0.3904.70 版本。我使用的驱动程序是否可能已过期?
我也想知道:chromium-browser 和 Chromedriver 有什么区别?我过去使用 Chromedriver 登录 Chrome 以与 Selenium 一起使用。
【问题讨论】:
标签: python google-chrome ubuntu amazon-ec2 selenium-chromedriver