在运行此代码
from selenium import webdriver
driver = webdriver.Chrome("/usr/bin/google-chrome")
使用新选项卡打开浏览器后退出并出现此错误
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 96, in start
self.assert_process_still_running()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/google-chrome unexpectedly exited. Status code was: 0
之后我无法使用驱动程序变量,因为它返回一个 NameError。
我用 pip 安装了 selenium,我使用的是 python 3.5.3。
编辑1:
我忘了提到我正在使用 Ubuntu 17.04 zesty