java - 在 Firefox 31 和 Selenium 2.42.2 上查找 <select> 元素非常慢

标签 java firefox selenium

我正在使用 firefox webdriver 进行测试,在 firefox 最近升级到 31 之前它运行良好。 firefox webdriver 需要几分钟才能找到一个元素,而在旧版本中这需要不到一秒钟。

这不会发生在所有网页中,也不会发生在同一页面上的所有元素中。好像只有第一个需要这么长时间。

有没有人遇到过类似的问题?任何建议将不胜感激,提前致谢!

问候, 汉博

下面是selenum日志供引用:

  18:02:55.941 INFO - Java: Oracle Corporation 24.51-b03
  18:02:55.944 INFO - OS: Windows 8 6.2 amd64
  18:02:55.961 INFO - v2.42.2, with Core v2.42.2. Built from revision 6a6995d
  ......
  18:03:42.840 INFO - Executing: [new session: Capabilities [{firefox_profile=UEsDBBQACAgIAHWQ+UQAAAAAAAAAA..., browserName=firefox, unexpectedAlertBehaviour=ignore}]])
  18:03:42.865 INFO - Creating a new session for Capabilities [{firefox_profile=UEsDBBQACAgIAHWQ+UQAAAAAAAAAA..., browserName=firefox, unexpectedAlertBehaviour=ignore}]
  18:03:50.423 INFO - Done: [new session: Capabilities [{firefox_profile=UEsDBBQACAgIAHWQ+UQAAAAAAAAAA..., browserName=firefox, unexpectedAlertBehaviour=ignore}]]
  18:03:50.454 INFO - Executing: [set window position])
  18:03:50.483 INFO - Done: [set window position]
  18:03:50.491 INFO - Executing: [set window size])
  18:03:50.513 INFO - Done: [set window size]
  18:03:50.522 INFO - Executing: [page load wait: 60000])
  18:03:50.545 INFO - Done: [page load wait: 60000]
  18:03:50.552 INFO - Executing: [implicitly wait: 1000])
  18:03:50.565 INFO - Done: [implicitly wait: 1000]
  18:03:50.573 INFO - Executing: [set script timeoutt: 60000])
  18:03:50.589 INFO - Done: [set script timeoutt: 60000]
  18:03:50.596 INFO - Executing: [get: https://user:password@test.site])
  18:03:53.048 INFO - Done: [get:  https://user:password@test.site]
  ......here goes the first element, nearly 4 minutes and NO timeout
  18:04:09.796 INFO - Executing: [find element: By.id: input-dialog-year])
  18:07:44.731 INFO - Done: [find element: By.id: input-dialog-year]
  ......the second less than 1 second
  18:07:46.784 INFO - Executing: [find element: By.id: input-dialog-month])
  18:07:46.799 INFO - Done: [find element: By.id: input-dialog-month]
  ......all the follwing are normal
  18:07:48.960 INFO - Executing: [find element: By.id: info_sex_2])
  18:07:48.972 INFO - Done: [find element: By.id: info_sex_2]

最佳答案

根据changelog

  • 更新以支持 Firefox 28 的 native 事件(删除 native 事件 支持 Firefox 26)。现在支持 native 事件 以下 Firefox 版本:

    • 17(前一个 ESR 版本)
    • 24(当前 ESR 版本)
    • 27(紧接上一版本
    • 28(当前版本)

所以我认为您最好的选择是将您的 firefox 安装回滚到上面列出的版本之一。 Mozilla 保留了以前版本的 repo here .

关于java - 在 Firefox 31 和 Selenium 2.42.2 上查找 <select> 元素非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24953497/

相关文章:

java - 通过许多 Activity 传递变量

.net - AddressFamily.FireFox 在 .NET 套接字中指的是什么?

javascript - e.target.href 在 Firefox 中不工作

php - Selenium RC : How to check if an element has a given attribute?

java - 使用 keytool 找不到 SunPKCS11 提供程序

java - 从 Windows 路径字符串中提取驱动器号

java - 按周排序记录有帮助吗?

javascript - 如何在 Firefox 和 Chrome 中使用 'let'(以及支持的 ECMAScript 6 功能)

c# - Selenium 获取当前事件选项卡

c# - headless chrome 无法像宣传的那样工作