click_web(main_page_url)..._raise exception_class(message, screen, stacktrace) sessionnotcreate">
赞
踩
使用 Chrome 浏览器运行Web自动化测试报错,信息如下:
Traceback (most recent call last): File "click_csdn_chromedriver.py", line 80, in <module> click_web(main_page_url) File "click_csdn_chromedriver.py", line 13, in click_web browser = webdriver.Chrome() File "/home/zzh/.local/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__ desired_capabilities=desired_capabilities) File "/home/zzh/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/home/zzh/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/zzh/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/zzh/.local/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, 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 77
chrome和chromedriver版本不匹配
1、在chrome浏览器地址里面输入:chrome://version/,查看浏览器版本
2、找对应的chromedriver版本
chromedriver下载地址:http://chromedriver.storage.googleapis.com/index.html
对应我的chrome版本,我下载的是:
3、 解压
unzip chromedriver_linux64.zip
4、mv到/usr/local/bin/下
sudo mv chromedriver /usr/local/bin/
5、查看版本
chromedriver -v
ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185})
6、再次运行程序,一切ok!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。