Chrome Webdriver在Selenium中产生超时 [英] Chrome Webdriver produces timeout in Selenium
问题描述
我正在尝试使用Selenium和Chrome的webdriver抓取一个网站,并且在我切换到较新的Macbook之前,所有这些工作正常.突然,webdriver似乎无法识别网站何时完全加载.
I am trying to scrape a website using Selenium and Chrome's webdriver and this all worked fine until I switched to a newer Macbook. All of sudden, the webdriver seems to not recognize when the website is actually fully loaded.
错误消息如下
TimeoutException:消息:超时:无法从超时确定加载状态:超时从渲染器接收消息:-0.003
(会话信息:chrome = 54.0.2840.87)(驱动程序信息: chromedriver = 2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),平台= Mac OS X 10.12.1 x86_64)
TimeoutException: Message: timeout: cannot determine loading status from timeout: Timed out receiving message from renderer: -0.003
(Session info: chrome=54.0.2840.87) (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.12.1 x86_64)
我的代码如下:
import os
import time
from selenium import webdriver
driver = webdriver.Chrome(os.path.join(os.getcwd(), 'chromedriver'))
driver.get('http://www.clever-tanken.de/')
推荐答案
听起来可能很奇怪,但它与语言首选项有关.在我弄清楚我的旧mac(代码可以正常工作)和新mac(代码不断崩溃)之间的最后一个区别是语言偏好之后,我将其更改为英语.现在,代码运行正常!
So as strange as it might sound, it had to do with the language preferences. After I figured out that the last remaining difference between my old mac(where the code worked fine) and my new mac(on which the code kept crashing) was the language preferences, I changed it to English. Now, the code runs fine!
这篇关于Chrome Webdriver在Selenium中产生超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!