我正在尝试使用selenium打开一个代码低于的网页
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('bing.com')
我尝试使用executable_path=
,但它显示为chromedriver needs to be in PATH
,所以我将驱动程序添加到路径变量中我认为这不是的问题
而且我正在使用WSL2
这是完整的错误
Traceback (most recent call last):
File "/mnt/d/project/src/main.py", line 9, in <module>
driver = webdriver.Chrome()
File "/home/amirhosein/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/amirhosein/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/amirhosein/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
在windows或mac操作系统上安装selenium,而不是linx或wsl。我也遇到了同样的问题,使用window解决了问题,很抱歉他没有推理原因。
祝好运