赞
踩
chrome
运行一段时间后崩溃,代码没动,之前是好好的,超时和异常也处理了,还是莫名崩溃
- File "E:\github\yunkt\app.py", line 154, in get_book_isbn
- browser_douban.execute_script('window.stop()') # 当页面加载时间超过设定时间,通过执行Java
- File "C:\Users\dsx2016\.virtualenvs\yunkt-DsIKp6kf\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
- 'args': converted_args})['value']
- File "C:\Users\dsx2016\.virtualenvs\yunkt-DsIKp6kf\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
- self.error_handler.check_response(response)
- File "C:\Users\dsx2016\.virtualenvs\yunkt-DsIKp6kf\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
- raise exception_class(message, screen, stacktrace)
- selenium.common.exceptions.TimeoutException: Message: timeout
- (Session info: chrome=76.0.3809.132)
- (Driver info: chromedriver=70.0.3538.97 (d035916fe243477005bc95fe2a5778b8f20b6ae1),platform=Windows NT 10.0.17763 x86_64)
一开始关注的是selenium
超时问题
selenium.common.exceptions.TimeoutException: Message: timeout
后来发现是chrome
版本自己悄悄升级了,造成了chromedriver
驱动版本对不上,对应方法也失效了
错误提示
- (Session info: chrome=76.0.3809.132)
- (Driver info: chromedriver=70.0.3538.97
版本不对导致以下代码出错
- # 设定页面加载限制时间
- browser.set_page_load_timeout(10)
查看chrome
版本
点击设置,点击关于chrome
或者地址输入
chrome://settings/help
chromedriver
驱动网站
地址: http://npm.taobao.org/mirrors/chromedriver/
选择chromedriver_win32.zip
解压为 exe
文件即可
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。