【问题标题】:Python Selenium Webdriver hangsPython Selenium Webdriver 挂起
【发布时间】:2015-05-18 09:00:40
【问题描述】:

我最近从 火狐 16 到 29 硒 2.33 至 2.43

以前的设置工作正常,但升级后我看到它在开始步骤本身挂起:

firefoxprofile = webdriver.FirefoxProfile(profile_directory = firefoxProfilePath)
firefoxprofile.set_preference('webdriver_assume_untrusted_issuer', False)
firefoxprofile.set_preference('webdriver_accept_untrusted_certs', True)
firefoxprofile.set_preference('browser.download.folderList', 2) # custom location
firefoxprofile.set_preference('browser.download.manager.showWhenStarting', False)
downloadLocation = os.path.join(os.getcwd(), 'results', config.IDL_IP)                           
firefoxprofile.set_preference('network.proxy.type', 0)
firefoxprofile.set_preference('browser.download.dir', downloadLocation)
firefoxprofile.set_preference('browser.helperApps.neverAsk.openFile', downloadFormat)
firefoxprofile.set_preference('browser.helperApps.neverAsk.saveToDisk', downloadFormat)
firefoxprofile.update_preferences()

firefoxdriver = webdriver.Firefox(firefox_profile=firefoxprofile )

它挂在最后一步 我也在使用 Xvfb 的无头服务器上运行它。

【问题讨论】:

  • 你能不能告诉你如何开始Xvfb
  • 我没有启动Xvfb,它已经安装好了。我使用 pyvirtualdisplay 在无头模式下运行 selenium。还有一点是,如果我一次运行一个脚本,它可以工作,但如果我尝试同时运行,那么它有时会挂起

标签: python-2.7 firefox selenium selenium-webdriver


【解决方案1】:

很可能是 firefox/selenium 兼容性问题。也许this 有帮助。

(我宁愿添加评论,但我还差 4 个代表点)。

【讨论】:

  • 我验证了 Selenium 站点并且 Selenium 2.43 支持 Firefox 29 原生元素
  • 阅读本文changelog 我发现了这个:v2.43.0 - 支持 Firefox 24、31 和 32。试试这些版本之一。
猜你喜欢
  • 2018-07-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多