首页 > 解决方案 > raise WebDriverException("无法连接到服务 %s" % self.path)

问题描述

我正在尝试在 virtualenv 中通过 selenium 打开一个 google chorme。但它不起作用。

我试过把更具体的 chormedirver.exe 路径和

我试图将路径修复为 Chrome(excutable_path='./chromedriver.exe')

但他们都没有工作

请帮我

我在 WSL2 上使用 ubuntu

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome("./chromedriver.exe")
driver.get("http://www.python.org")

这是我的错误

    Traceback (most recent call last):
  File "/mnt/c/Users/USER/코드/selenium/google.py", line 4, in <module>
    driver = webdriver.Chrome("./chromedriver.exe")
  File "/home/princezheda/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/home/princezheda/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 104, in start
    raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service ./chromedriver.exe

标签: pythonseleniumselenium-webdriver

解决方案


推荐阅读