我在使用Selenium web Driver编写的测试自动化时,我正在经历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:使用page_object)
link(:annual_reporting_link, :id => 'annualReportingLinkId')
def go_to_reporting
mouse_over_home
wait_until(5) do
annual_reporting_link
end
end
结果:由于链接闪烁,无法单击链接。
然后我尝试了以下(方法2:使用send_keys)
@browser.find_element(:id, 'annualReportingLinkId').send_keys :return
and
@browser.find_element(:id, 'annualReportingLinkId').send_keys(KEYS.ENTER)
,但它也行不通。运行测试时,我会遇到此错误:
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&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&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>
测试自动化能够花费"主菜单",其中包含子菜单 - 超链接。但是在鼠标_OVER_HOME(主页菜单)之后,子菜单开始闪烁。我需要单击" yeary_reporting_link"才能转到此报告页面,但是由于闪烁,测试自动化根本无法单击它。
有人有一个为您服务的解决方案吗?请分享您的解决方案。
环境:
Ruby: 1.9.3
Cucumber: 2.1.0
Selenium Webdriver: 2.53.4
page-object: 1.2.0
IE: 11
我在使用Selenium Webdriver和IE之前就遇到了这个问题。我发现这是我版本的IE和Selenium Webdriver之间的错误。
当我遇到这个问题时,我在单击链接并调试测试之前提出了一个突破点此错误,链接简单地"闪烁",没有反应。
我建议将您的Selenium Web Driver版本升级到版本3.0.0,该版本应该解决问题。
如果您不想跳到Selenium Webdriver 3.0.0,则需要找出您正在使用的IE 11的确切版本。尝试升级或降级您的IE 11版本,这也应该解决该问题,但是您可能会发现自己陷入了IE 11版本,直到您升级到Selenium WebDriver3.0.0。
Antoher解决方案是将持续的悬停在您的IE配置文件中设置为false,类似的内容:
profile = Selenium::WebDriver::IE::Profile.new
profile['enablePersistentHover'] = false
driver = Selenium::WebDriver.for :IE, :profile => profile