Ubuntu 16.04 LTS解决报错“session not created: Chrome version must be between 70 and 73”

        在解决了上一条博客提到的问题后,又出现了新错误:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73
  (Driver info: chromedriver=73.0.3683.86,platform=Linux 4.15.0-48-generic x86_64)

        完整报错是这样的:

203.192.217.11:8080
Mozilla/5.0 (Linux; Android 7.0; Redmi Note 4X Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044304 Mobile Safari/537.36 MicroMessenger/6.7.3.1360(0x26070333) NetType/WIFI Language/zh_CN Process/tools
Traceback (most recent call last):
  File "main.py", line 70, in 
    driver = set_driver()
  File "/home/u25th_engineer/document/code/Python/Analog-access/driver.py", line 25, in set_driver
    return webdriver.Chrome(chrome_options=chromeOptions)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/root/anaconda3/lib/python3.7/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: Chrome version must be between 70 and 73
  (Driver info: chromedriver=73.0.3683.86,platform=Linux 4.15.0-48-generic x86_64)

        解决方法:

        1. 在地址栏输入:

chrome://settings/help

查看自己的chrome浏览器版本(注意得是70到73的);

Ubuntu 16.04 LTS解决报错“session not created: Chrome version must be between 70 and 73”_第1张图片 图1 查看chrome浏览器版本

 

        2. 到官网(因为是Google的原因,需要某些工具你懂的)下载对应的驱动(也可以找国内网站的资源,上网搜,都有的!);

Ubuntu 16.04 LTS解决报错“session not created: Chrome version must be between 70 and 73”_第2张图片 图2 官网下载界面

 

        3. 选择了对应的chrome浏览器版本后,上面的网址将会指引你去下载对应版本的驱动;

Ubuntu 16.04 LTS解决报错“session not created: Chrome version must be between 70 and 73”_第3张图片 图3 下载文件界面

 

        4. 下载完成后,到下载文件所在路径,打开终端;

        5. 解压文件(我安装了unar,所以可以如图这么干,一般.zip文件用unzip命令解压就行);

图4 解压文件

        6. 之后连续输入以下三个命令:

chmod +x chromedriver
sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver

如果出现如下类似提示:

图5 软链接已存在

 

把原来的删掉就行:

rm -rf  /usr/bin/chromedriver

第6步完成;

        7. 进入/usr/bin目录下确认是否有chromedriver文件:

cd /usr/bin
Ubuntu 16.04 LTS解决报错“session not created: Chrome version must be between 70 and 73”_第4张图片 图6 查看文件是否存在

 

        8. 完成。

 

参考资料:

链接1

链接2

你可能感兴趣的:(Linux学习,札记,Python)