繁体   English   中英

无法使用Selenium IDE在网站上找到按钮

[英]fail to locate a button on website using Selenium IDE

JI刚开始使用Selenium来测试网站。 但是,在网站上我无法同时使用链接和xpath找到一个按钮。 URL是http://hra.case.edu/info 如果您在名字输入框中输入像John一样的内容,则网站将呈现一个表格,显示您可能的用户身份。 我需要单击第一个按钮“这就是我”。

这是我的硒测试用例源代码

<tr>
    <td>open</td>
    <td>/</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Get Started</td>
    <td></td>
</tr>

<tr>
    <td>keyPress</td>
    <td>name=searchFirstName</td>
    <td>John</td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>name={&quot;$&quot;:{&quot;memLimit&quot;:2000,<br />&quot;autoFlush&quot;:true,<br />&quot;crossDomain&quot;:false,<br />&quot;includeProtos&quot;:false,<br />&quot;includeFunctions&quot;:false,<br />&quot;currentDomain&quot;:&quot;case.edu&quot;}}</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>//*[@id='select_user']/tr[1]/td[1]/a</td>
</tr>

It fails at the last step said [error] Element Xpath//*[@id'select_user']/tr[1]/td[1]/a not found

有人知道如何找到该按钮吗? 谢谢! ps我可以使用Firebug控制台找到该按钮

>>> $x(".//*[@id='select_user']/tr[1]/td[1]/a")
[a.btn /midlife/149]

你只需要像那样等待

command waitForElementPresent

target Xpath//*[@id'select_user']/tr[1]/td[1]/a

尝试下面的xpath

"//div[@id='content']//tbody[@id='select_user']/tr[1]//a"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM