Ruby Cumber:Selenium Webdirver-IE 11链接闪烁,无法点击

Ruby Cumber:Selenium Webdirver-IE 11链接闪烁,无法点击,ruby,internet-explorer,selenium-webdriver,cucumber,page-object-gem,Ruby,Internet Explorer,Selenium Webdriver,Cucumber,Page Object Gem,当我使用SeleniumWebDriver运行用Ruby Cucumber编写的测试自动化时,我遇到IE浏览器链接闪烁问题 Scenario: Navigating to Reporting home page. Given I see menu Reporting available. When I navigate to "Annual Reporting". Then I see the correct header on Annual Repor

当我使用SeleniumWebDriver运行用Ruby Cucumber编写的测试自动化时,我遇到IE浏览器链接闪烁问题

   Scenario: Navigating to Reporting home page.
      Given I see menu Reporting available.
      When I navigate to "Annual Reporting".
      Then I see the correct header on Annual Reporting page.
home_page.rb(方法1:使用页面对象)

结果:由于链接闪烁,无法单击链接

然后我尝试了以下方法(方法2:使用send_键)

但它也不起作用。我在运行测试时遇到此错误:

 Selenium::WebDriver::Error::ElementNotVisibleError: Cannot click on element
HTML:

     <div id="homeMenu">
        <ul>
         <li class="has-sub"><a class="homeButton" href="/report-web"></a>
          <ul id="homeLinks">
             <li id="report1LiId"><a href="/report-web/openItems?subApp=report1&amp;rptid=15" id="report1LinkId" class="disabledLinks"><span id="report1LinkName" class="disabledLinksText">Report 1</span></a></li>
             <li id="report2Id"><a href="/report-web/realms?subApp=report2&amp;rptid=16" id="report2LinkId" class="disabledLinks"><span id="report2LinkName" class="disabledLinksText">Report 2</span></a></li>
             <li id="annualLiId"><a href="/report-web?subApp=annual" id="annualReportingLinkId"><span id="annualReportingLinkName">Annual Reporting</span></a></li>
             <li id="administrationLiId"><a href="/report-web/administration?subApp=ADMIN" id="administrationLinkId" class="disabledLinks"><span id="administrationLinkName" class="disabledLinksText">Manage Users</span></a></li>
           </ul>
        </li>
   </ul>
  </div>

在使用SeleniumWebDriver和IE之前,我就遇到过这个问题。我发现这是我的IE版本和SeleniumWebDriver之间的一个bug

当我遇到这个问题时,我在点击链接并调试测试之前设置了一个断点,然后我手动尝试在IE中点击链接,但由于这个错误,我10次中仍有9次无法点击,链接只是“闪烁”并且没有响应

我建议将您的Selenium Webdriver版本升级到3.0.0版,这样应该可以解决问题

如果您不想跳转到SeleniumWebDriver 3.0.0,您需要了解您正在使用的IE11的确切版本。尝试升级或降级您的IE 11版本,这也会解决问题,但您可能会发现,在升级到Selenium Webdriver 3.0.0之前,您一直使用IE 11版本

另一种解决方案是在IE配置文件中将持续悬停设置为false,如下所示:

profile = Selenium::WebDriver::IE::Profile.new
profile['enablePersistentHover'] = false

driver = Selenium::WebDriver.for :IE, :profile => profile

在使用SeleniumWebDriver和IE之前,我就遇到过这个问题。我发现这是我的IE版本和SeleniumWebDriver之间的一个bug

当我遇到这个问题时,我在点击链接并调试测试之前设置了一个断点,然后我手动尝试在IE中点击链接,但由于这个错误,我10次中仍有9次无法点击,链接只是“闪烁”并且没有响应

我建议将您的Selenium Webdriver版本升级到3.0.0版,这样应该可以解决问题

如果您不想跳转到SeleniumWebDriver 3.0.0,您需要了解您正在使用的IE11的确切版本。尝试升级或降级您的IE 11版本,这也会解决问题,但您可能会发现,在升级到Selenium Webdriver 3.0.0之前,您一直使用IE 11版本

另一种解决方案是在IE配置文件中将持续悬停设置为false,如下所示:

profile = Selenium::WebDriver::IE::Profile.new
profile['enablePersistentHover'] = false

driver = Selenium::WebDriver.for :IE, :profile => profile

请发布复制此问题所需的(最低数量)
selenium webdriver
代码。我刚刚用一些代码编辑了我的问题。谢谢“链接闪烁”是什么意思?这是一个导航菜单,您需要将鼠标悬停在上面以单击子菜单链接吗?如果是这样的话,你是如何扩展菜单的?即
mouse\u\u home
做什么?嗨,贾斯汀,我刚刚用你的问题更新了我上面的问题。是的,我需要将鼠标悬停在子菜单链接上。请告诉我你的想法。谢谢嗨,贾斯汀,听起来你可能在使用SeleniumWebDriver的IE浏览器上遇到过同样的问题。你知道有什么解决办法吗?谢谢请发布复制此问题所需的(最低数量)
selenium webdriver
代码。我刚刚用一些代码编辑了我的问题。谢谢“链接闪烁”是什么意思?这是一个导航菜单,您需要将鼠标悬停在上面以单击子菜单链接吗?如果是这样的话,你是如何扩展菜单的?即
mouse\u\u home
做什么?嗨,贾斯汀,我刚刚用你的问题更新了我上面的问题。是的,我需要将鼠标悬停在子菜单链接上。请告诉我你的想法。谢谢嗨,贾斯汀,听起来你可能在使用SeleniumWebDriver的IE浏览器上遇到过同样的问题。你知道有什么解决办法吗?谢谢嗨,丹,谢谢你的留言。我将Ruby升级到2.3,将SeleniumWebDriver升级到3.0.0。我的Gemfile.lock文件显示的是
selenium webdriver(3.0.0)childprocess(~>0.5)rubyzip(~>1.0)websocket(~>1.0)
您有这些吗?但我仍然得到相同的链接闪烁错误。我错过了什么?谢谢嗨,方丰,你有什么版本的IE 11?谢谢,DanHi Dan,IE版本是11.0.9600.18524CO。(我忘了提到我还将页面对象gem升级到了2.0.0,以使用SeleniumWebDriver gem 3.0.0)。谢谢隐马尔可夫模型。。升级我的Selenium Webdriver和IE 11对我很有用。看来IE在SeleniumWebDriver上有很多bug。我能想到的最后一件事是,我在别处读到过,让你尝试一下,那就是改变你想要的IE,禁用持久悬停。类似这样的内容:'caps=Selenium::WebDriver::Remote::Capabilities.internet_explorer caps['enablePersistentHover']=false driver=Selenium::WebDriver.for(:Remote,:desired_Capabilities=>caps)'抱歉,上面的评论格式不正确,我无法编辑,请查看上面原始答案的更新版本:)嗨,丹,谢谢你的留言。我将Ruby升级到2.3,将SeleniumWebDriver升级到3.0.0。我的Gemfile.lock文件显示的是
selenium webdriver(3.0.0)childprocess(~>0.5)rubyzip(~>1.0)websocket(~>1.0)
您有这些吗?但我仍然得到相同的链接闪烁错误。我错过了什么?谢谢嗨,方丰,你有什么版本的IE 11?谢谢,DanHi Dan,IE版本是11.0.9600.18524CO。(我忘了提到我还将页面对象gem升级到了2.0.0,以使用SeleniumWebDriver gem 3.0.0)。谢谢隐马尔可夫模型。。升级我的Selenium Webdriver和IE 11对我很有用。看来IE在SeleniumWebDriver上有很多bug。我能想到的最后一件事是,我在别处读到过,让你尝试一下,那就是改变你想要的IE,禁用持久悬停。类似这样的内容:“caps=Selenium::WebDriver::Remote::Capabilities.internet_explorer caps['enablePersistentHover']=false driver=Selenium::WebDriver.for(:Remote,:desired_Capabilities=>caps)”很抱歉,上面的评论对您来说很糟糕
   Ruby: 1.9.3
   Cucumber: 2.1.0
   Selenium Webdriver: 2.53.4 
   page-object: 1.2.0
   IE: 11
profile = Selenium::WebDriver::IE::Profile.new
profile['enablePersistentHover'] = false

driver = Selenium::WebDriver.for :IE, :profile => profile