簡體   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