Ani*_*ilD 7 google-chrome python-3.x selenium-webdriver webdriver-manager webdrivermanager-python
我有一个错误:
E selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 102
E Current browser version is 109.0.5414.120 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Run Code Online (Sandbox Code Playgroud)
我已经使用代码来获取最新版本的 webdriver-
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--allow-running-insecure-content")
options.add_argument("--ignore-certificate-errors")
options.set_capability("acceptInsecureCerts", True)
preferences = {"profile.default_content_settings.popups": 0,
"download.default_directory": r""+Constants.path+"",
# IMPORTANT - ENDING SLASH V IMPORTANT
"directory_upgrade": True}
options.add_experimental_option("prefs", preferences)
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)
Run Code Online (Sandbox Code Playgroud)
使用相同的代码,我可以在本地计算机(即笔记本电脑)上运行此代码,但此代码无法在我的虚拟机上运行。两台机器上的 chrome 版本相同,即 - 109.0.5414.120。
请指导。
在我的虚拟机上,我发现有两个不同版本的 Chrome(一个最新版本和一个旧版本)安装在两个不同的位置。因此,我卸载了 chrome 并删除了所有 chrome/google 关联的文件夹和文件,然后安装了新版本的 google chrome 浏览器。最后,代码运行成功。
归档时间: |
|
查看次数: |
7734 次 |
最近记录: |