JI just started to use Selenium to test a website. However, there a button on the website I cannot locate using both link and xpath. The URL is http://hra.case.edu/info . If you type like John in the first name input box, the website will render a table that shows the possible user you are. And I need to click the first button "This is me".
Here is my test case source code for Selenium
<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={"$":{"memLimit":2000,<br />"autoFlush":true,<br />"crossDomain":false,<br />"includeProtos":false,<br />"includeFunctions":false,<br />"currentDomain":"case.edu"}}</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
Anyone know how to locate that button? Thanks! ps I can use firebug console to locate that button
>>> $x(".//*[@id='select_user']/tr[1]/td[1]/a")
[a.btn /midlife/149]
That you just need to wait like that
command
- waitForElementPresent
target
- Xpath//*[@id'select_user']/tr[1]/td[1]/a
尝试下面的xpath
"//div[@id='content']//tbody[@id='select_user']/tr[1]//a"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.