英文:
python selenium chrome driver 111 path is not handled
问题
有这段代码:
#!/usr/bin/env python
import selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
import undetected_chromedriver as uc
driver = uc.Chrome(executable_path='/usr/local/bin/chromedriver', options=chrome_options)
# 代码
当我运行脚本时,出现以下错误:
from session not created: This version of ChromeDriver only supports Chrome version 111
Current browser version is 110.0.5481.100
</br>
$ /usr/local/bin/chromedriver --version
ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})
问题出在哪里?
用以下方式测试也出现相同的错误:
from selenium import webdriver
import chromedriver_autoinstaller
chromedriver_autoinstaller.install()
英文:
I have this code:
#!/usr/bin/env python
import selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
import undetected_chromedriver as uc
driver = uc.Chrome(executable_path='/usr/local/bin/chromedriver', options=chrome_options)
# code
When I run the script, I get:
from session not created: This version of ChromeDriver only supports Chrome version 111
Current browser version is 110.0.5481.100
</br>
$ /usr/local/bin/chromedriver --version
ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})
What's wrong?
Tested also with
from selenium import webdriver
import chromedriver_autoinstaller
chromedriver_autoinstaller.install()
Same error.
答案1
得分: 1
你的计算机上安装了两个 Chrome 实例。
默认位置的 Chrome 实例未被你的测试框架使用。你的测试使用了另一个 Chrome 安装实例,该实例尚未更新到最新的 v110.0 版本。
因此,尽管 chromedriver_autoinstaller 下载并安装了最新的 ChromeDriver v110.0,但是 ChromeDriver 版本与 [tag:google-chrome] 版本不匹配。因此你会看到这个错误。
英文:
There are two instances of Chrome installed in your machine.
The Chrome instance installed at the default location isn't used by your test framework. Your tests uses another instance of Chrome installation which isn't updated to recent v110.0 levels.
Hence, though chromedriver_autoinstaller downloads and installs the latest ChromeDriver v110.0 but there is mismatch between ChromeDriver version and [tag:google-chrome] version. Hence you see the error.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论