Chrome Webdriver 在 Selenium 中产生超时 [英] Chrome Webdriver produces timeout in Selenium

查看:55
本文介绍了Chrome Webdriver 在 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)(驱动程序信息:铬驱动程序=2.25.426935(820a95b0b81d33e42712f9198c215f703412e1a1),平台=Mac OS X 10.12.1x86_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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆