我正在尝试运行一个简单的selenium程序,可以打开一个网站,但是当我 输入代码chrome应用程序将打开几秒钟,然后终端会弹出下面的错误。这是我插入pycharm的代码
from selenium import webdriver
from selenium import webdriver
browser = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe')
然后给出该错误文本:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\Billy Kimbell\!Coding!\Projects In Python\test\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\Billy Kimbell\!Coding!\Projects In Python\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start
self.assert_process_still_running()
File "C:\Users\Billy Kimbell\!Coding!\Projects In Python\test\venv\lib\site-packages\selenium\webdriver\common\service.py", line 109, in assert_process_still_running
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
任何与此相关的帮助都将不胜感激,因为我即将开始使用此软件
当所有工具的版本都正确时,我也遇到了这个问题,以下是我的解决方案:
转到selenium的文件夹并找到chrome的目录,我的路径如下:
D:\install\python3\Lib\site-packages\selenium\webdriver\chrome
编辑options.py并将chrome.exe的路径添加到init的_binary_位置,如下所示:
相关问题 更多 >
编程相关推荐