我无法解决这个错误,我尝试了所有建议启动chrome webdriver与我当前的配置文件
Message: unknown error: Chrome failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:Program FilesGoogleChromeApplicationchrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
代码在
下面from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from pathlib import Path
import time
# initialize the Chrome driver
_options = webdriver.ChromeOptions()
print(str(Path.home())+"/AppData/Local/Google/Chrome/User Data")
_options.add_argument("--user-data-dir=C:/Users/dmitr/AppData/Local/Google/Chrome/User Data")
_options.add_argument('--profile-directory=Default')
_options.add_argument("--no-sandbox")
_options.add_argument("--disable-dev-shm-usage")
#_options.add_argument("--headless")
s = Service('D:chromedriver')
driver = webdriver.Chrome(service=s, options=_options)
我没有任何其他我可以尝试,为什么这是不工作?
是否使用admin权限运行编辑器?当我运行你的代码,它失败了,直到我打开VSCode作为管理员,然后它工作。我正在使用ChromeDriver版本111.0.5563.64