前言:跟GPT交互,让其写一段代码,执行失败。经过排查验证,GPT写的代码没有问题,是本地环境问题。


执行报错:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 109
Current browser version is 112.0.5615.49 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

报错分析:

此版本的ChromeDriver 仅支持Chrome版本109。当前浏览器版本为112.0.5615.49 。根据报错得知本地的谷歌浏览器已经更新。

解决办法:

将与谷歌浏览器版本匹配的chromedriver.exe放到Python的安装目录下,也就是和python.exe同目录即可。


详细过程,如下:

1. 让cursor写一段python代码,如下:

from selenium import webdriver

# Create a new Chrome browser instance
browser = webdriver.Chrome() # Navigate to the Baidu homepage
browser.get('https://www.baidu.com/') # Wait for the page to load
browser.implicitly_wait(10) # Take a screenshot of the page and save it to a file
browser.save_screenshot('baidu_screenshot.png') # Close the browser
browser.quit()

2. 在pycharm运行报错,如下:

"D:\Program Files\python3\python.exe" "D:\Program Files\python3\Zyl\2023-04-11\demo11.py"
Traceback (most recent call last):
File "D:\Program Files\python3\Zyl\2023-04-11\demo11.py", line 4, in <module>
browser = webdriver.Chrome()
File "D:\Program Files\python3\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
super().__init__(
File "D:\Program Files\python3\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
super().__init__(
File "D:\Program Files\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "D:\Program Files\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "D:\Program Files\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "D:\Program Files\python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 109
Current browser version is 112.0.5615.49 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Stacktrace:
Backtrace:
(No symbol) [0x005B6643]
(No symbol) [0x0054BE21]
(No symbol) [0x0044DA9D]
(No symbol) [0x00472911]
(No symbol) [0x0046D630]
(No symbol) [0x0046A899]
(No symbol) [0x004A6917]
(No symbol) [0x004A655C]
(No symbol) [0x0049FB76]
(No symbol) [0x004749C1]
(No symbol) [0x00475E5D]
GetHandleVerifier [0x0082A142+2497106]
GetHandleVerifier [0x008585D3+2686691]
GetHandleVerifier [0x0085BB9C+2700460]
GetHandleVerifier [0x00663B10+635936]
(No symbol) [0x00554A1F]
(No symbol) [0x0055A418]
(No symbol) [0x0055A505]
(No symbol) [0x0056508B]
BaseThreadInitThunk [0x76C37D49+25]
RtlInitializeExceptionChain [0x774CB74B+107]
RtlClearBits [0x774CB6CF+191] Process finished with exit code 1

3. 配置谷歌驱动

  谷歌驱动下载地址:http://chromedriver.storage.googleapis.com/index.html

  驱动版本须与浏览器版本一致。

  将下载好的浏览器驱动解压,将解压出的 exe 文件替换到Python的安装目录下,也就是和python.exe同目录即可。

4. 再次执行代码,执行成功。

"D:\Program Files\python3\python.exe" "D:\Program Files\python3\Zyl\2023-04-11\demo11.py" 

Process finished with exit code 0

selenium报错:This version of ChromeDriver only supports Chrome version 109 Current browser version is 112.0.5615.49...解决办法的更多相关文章

  1. UI自动化执行时报Parent suite setup failed: SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81报错的问题解决

    持续集成在执行UI时报错:Parent suite setup failed: SessionNotCreatedException: Message: session not created: Th ...

  2. asp.net报错“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”的解决办法

    来源:http://ajxfxb.blog.163.com/blog/static/56675086201411634336878/ 作者是:没完没了的工作 asp.net报错“尝试读取或写入受保护的 ...

  3. win 2012 安装mysql 5.7.20 及报错 This application requires Visual Studio 2013 Redistributable. Please install the Redistributable then run this installer again 的解决办法

    本文地址:http://www.cnblogs.com/jying/p/7764147.html    转载请注明出处. 安装过程其实挺简单,基本上下一步下一步,可以参考我的另一篇mysql安装文章: ...

  4. Selenium chromeDriver启动时报错:session not created: This version of ChromeDriver only supports Chrome

    解决方案: 这是因为ChromeDriver与本地chrome浏览器的版本不一致导致 ChromeDriver下载地址:http://npm.taobao.org/mirrors/chromedriv ...

  5. 运行python代码报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 91: ordinal not in range(128)的解决办法

    1.通过搜集网上的资料,自己多次尝试,问题算是解决了,在代码中加上如下几句即可: import sys reload(sys) sys.setdefaultencoding('utf-8') 2.原因 ...

  6. vue引入fastclick设置输入框type="number"报错Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.的解决办法

    将输入框type设为text,通过正则验证输入的值

  7. 解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist

    解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist 早上在linux下用selenium启动Chro ...

  8. selenium报错以及各解决方法

    1.driver.findElement(By.name("wd")).sendKeys("selenium"); 报错:The method sendKeys ...

  9. Selenium报错:StaleElementReferenceException

    一个学生在操作页面跳转时遇到一个Selenium报错, 如下图所示: StaleElementReferenceException: Message: stale element reference: ...

  10. selenium报错汇总

    selenium报错汇总 报错:[error] Could not connect to Selenium Server. Have you started the Selenium Server y ...

随机推荐

  1. 2022-01-11:给定一个正数数组arr长度为n、正数x、正数y。 你的目标是让arr整体的累加和<=0, 你可以对数组中的数num执行以下三种操作中的一种,且每个数最多能执行一次操作 : 1.

    2022-01-11:给定一个正数数组arr长度为n.正数x.正数y. 你的目标是让arr整体的累加和<=0, 你可以对数组中的数num执行以下三种操作中的一种,且每个数最多能执行一次操作 : ...

  2. uni-app Pages.json配置

    https://uniapp.dcloud.net.cn/collocation/pages.html pages.json 文件用来对 uni-app 进行全局配置,决定页面文件的路径.窗口样式.原 ...

  3. 计蒜客蓝桥杯省赛模拟G

    题目 一天蒜头君得到 n 个字符串 si,每个字符串的长度都不超过 1010. 蒜头君在想,在这 n 个字符串中,以 si 为后缀的字符串有多少个呢? 输入格式 第一行输入一个整数 n. 接下来 n ...

  4. TypeError: Cannot read property 'getAttribute' of undefined

    今天使用echarts + vue 做 图标,运行时提示vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in mounted hook: "Typ ...

  5. mac -bash: ls: No such file or directory

    再mac 输入ls 竟然提示我 如图其他到命令都不能用了??? 网上找了大半天.看见这种类似的很多,但是最后都不是我要的答案,最后没辙,注销用户,重新登陆,问题没有了,也不知道是不是mac的bug:有 ...

  6. Three.js 进阶之旅:滚动控制模型动画和相机动画 🦢

    声明:本文涉及图文和模型素材仅用于个人学习.研究和欣赏,请勿二次修改.非法传播.转载.出版.商用.及进行其他获利行为. 摘要 专栏上篇文章<Three.js 进阶之旅:页面*滑滚动-王国之泪&g ...

  7. 如何不使用图形来创建ACFS文件系统

    客户需求,提供在19c环境下,ACFS的命令行操作的具体步骤,便于在图形界面不可用场景使用. 当然,如果有图形可操作,还是推荐首选图形,避免复杂度以及不必要的错误. 其实之前有测试过11g环境下的AC ...

  8. vscode使用chatGPT

    vscode使用chatGPT 一.下载chatPGT 在拓展中找到chatGPT,我这里下载的是中文版 二.使用 1.使用快捷键 ctrl+shift+p进行查找 chatGPT 2.点击请输入问题 ...

  9. 在Istio中,到底怎么获取 Envoy 访问日志?

    Envoy 访问日志记录了通过 Envoy 进行请求 / 响应交互的相关记录,可以方便地了解具体通信过程和调试定位问题. 环境准备 部署 httpbin 服务: kubectl apply -f sa ...

  10. x.ai还是OpenAI?埃隆·马斯克的AI帝国【1】

    大家可能知道,在上个月底埃隆·马斯克与1000多名来自各个行业的专家一起联名签署了"Future of Life Institute"发起的一个请愿书,呼吁全社会暂停至少6个月的高 ...