成功解决:selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 294.905
(Session info: headless chrome=102.0.5005.115)
报错问题:最近跑自动化爬虫时遇到的问题
File "D:\Python3.8\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 294.905
(Session info: headless chrome=102.0.5005.115)
Stacktrace:
Backtrace:
Ordinal0 [0x00762733+2434867]
Ordinal0 [0x006F07A1+1968033]
Ordinal0 [0x005DC678+837240]
Ordinal0 [0x005CD740+776000]
Ordinal0 [0x005CC565+771429]
Ordinal0 [0x005CCB68+772968]
Ordinal0 [0x005D780F+817167]
Ordinal0 [0x005E251B+861467]
Ordinal0 [0x005E4F30+872240]
Ordinal0 [0x005CCE36+773686]
Ordinal0 [0x005E2365+861029]
Ordinal0 [0x00634BDD+1199069]
Ordinal0 [0x00624256+1131094]
Ordinal0 [0x005FE840+976960]
Ordinal0 [0x005FF736+980790]
GetHandleVerifier [0x009D3C72+2515426]
GetHandleVerifier [0x009C702F+2463135]
GetHandleVerifier [0x0080522A+620442]
GetHandleVerifier [0x00804016+615814]
Ordinal0 [0x006F707B+1994875]
Ordinal0 [0x006FB938+2013496]
Ordinal0 [0x006FBA25+2013733]
Ordinal0 [0x00704DE1+2051553]
BaseThreadInitThunk [0x75B2FA29+25]
RtlGetAppContainerNamedObjectPath [0x772A7A9E+286]
RtlGetAppContainerNamedObjectPath [0x772A7A6E+238]
根本原因是加载内容过多,导致的超时。
1、临时解决方法:chrome_options.add_argument('--headless')
(该‘浏览器不提供可视化页面’设置去掉)
2、添加不加载图片设置,提升速度:chrome_options.add_argument('blink-settings=imagesEnabled=false')