python selenium chrome driver 111路径未处理

huangapple go评论167阅读模式
英文:

python selenium chrome driver 111 path is not handled

问题

有这段代码:

  1. #!/usr/bin/env python
  2. import selenium
  3. from selenium import webdriver
  4. from selenium.webdriver.common.by import By
  5. from selenium.webdriver.chrome.options import Options
  6. chrome_options = Options()
  7. import undetected_chromedriver as uc
  8. driver = uc.Chrome(executable_path='/usr/local/bin/chromedriver', options=chrome_options)
  9. # 代码

当我运行脚本时,出现以下错误:

  1. from session not created: This version of ChromeDriver only supports Chrome version 111
  2. Current browser version is 110.0.5481.100
  3. </br>
  4. $ /usr/local/bin/chromedriver --version
  5. ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})

问题出在哪里?

用以下方式测试也出现相同的错误:

  1. from selenium import webdriver
  2. import chromedriver_autoinstaller
  3. chromedriver_autoinstaller.install()
英文:

I have this code:

  1. #!/usr/bin/env python
  2. import selenium
  3. from selenium import webdriver
  4. from selenium.webdriver.common.by import By
  5. from selenium.webdriver.chrome.options import Options
  6. chrome_options = Options()
  7. import undetected_chromedriver as uc
  8. driver = uc.Chrome(executable_path=&#39;/usr/local/bin/chromedriver&#39;, options=chrome_options)
  9. # code

When I run the script, I get:

  1. from session not created: This version of ChromeDriver only supports Chrome version 111
  2. Current browser version is 110.0.5481.100

</br>

  1. $ /usr/local/bin/chromedriver --version
  2. ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995})

What's wrong?

Tested also with

  1. from selenium import webdriver
  2. import chromedriver_autoinstaller
  3. 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.

huangapple
  • 本文由 发表于 2023年3月12日 13:59:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75711311.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定