硒webdriver IE按钮问题 [英] selenium webdriver IE button issue

查看:54
本文介绍了硒webdriver IE按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为FF编写脚本,但我希望他们所做的工作很少,但它们也可以在其他浏览器上运行,但是IE驱动程序似乎存在按钮问题?

I have been writing my scripts for FF but was hoping with little work they would also run on the other browsers but it seems IE driver has button issues?

我在按钮上有一个简单的webelement.click(),该按钮不会引发错误,但不会单击该按钮.在FF它的罚款.我可以获取文本,获取价值,所以我知道find语句是可以的,只是不会单击它.

I have a simple webelement.click() on a button that does not throw an error but does not click the button. in FF its fine. I can get text, get value so I know the find statement is ok it just will not click it.

想法或帮助会很棒

只要做

WebElement element;
element = driver.findElement(By.id("pageheader_login"));
element.click();

HTML-控件上有3个按钮,我现在只对登录有兴趣

HTML - The control has 3 buttons on it I am only interested for now with the login

<div id="_ctl0_pageheader_navcontainer">
  <div id="phwelcome">

    <br class="clear" />
  </div>
  <span id="navtext">

    <a id="_ctl0_pageheader_lnkRegister" class="logichref" 
       href="http://Register/1">Register Today</a>
    <label id="_ctl0_pageheader_lblRegisterBar" class="barhide">| </label>

    <a id="_ctl0_pageheader_customerconnection" class="logichref" 
       href="http://test.com" target="_blank">Help & Training</a>
    <label class="bar">| </label>
    <a class="logichref" href="http://test.aspx"
       onmouseover="window.status='';return(true);" 
       onmouseout="window.status='';return(false);"
       target="_blank">What's New</a> 
    <label class="bar">| </label>
    <a id="_ctl0_pageheader_login" class="lbOn loginModal" 
       href="http://test/loginlightbox.aspx">Login</a>
  </span>
</div>     

推荐答案

遇到相同的问题,单击不适用于我的IE 8. 我找到了一种解决方法,在其中执行element.sendKeys("\ n")来执行单击(基本上我只是按按钮上的Enter). 不是很干净,但是可以在修复错误之前起作用!

Got the same problem, click does not work with my IE 8. I found a workaround where I do a element.sendKeys("\n") to perform the click (basically I just press enter on the button). Not very clean but it works until the bug is fixed!

这篇关于硒webdriver IE按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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