2014-01-13 19 views
0

我正在測試我們基於網絡的應用程序使用硒。我有一個動態id的按鈕有問題,並且類與最後一個html頁面類似,所以我無法繼續進行測試。下面是按鈕的來源硒動態編號有問題

input id =「aui_3_4_0_1_554」class =「addto_cart_button」type =「button」onclick =「chkMaxRequestPerDay();」值=「請求報價」>

我想知道我怎麼能告訴硒IDE用值來檢查,以便它可以繼續

感謝

回答

1

,你可以嘗試使用XPath與價值,

//input[@value='Request Quote'] 

//input[@value='Request Quote' and @class='addto_cart_button'] 
+0

我已經試過了Amith它不工作 – Pravin

+0

您是否嘗試過將類名與價值結合起來? – Amith

+0

感謝阿米特,母鹿的工作..它能夠找到按鈕...但現在的問題是,當我添加一個命令單擊它的infront它不通過...但是當我添加一個切換點,然後恢復,然後其經過... – Pravin

0

我認爲像貝羅W¯¯也應努力

//input[contains(@id, 'aui_')] 

//input[@class='addto_cart_button'] 

這會給你一個列表 循環通過他們和循環檢查

loop over List<Webelement> { 
if(webelement.getAttribute("onclick").indexOf("chkMaxRequestPerDay") != -1) { 
    // here is the element. do what ever you want 
} 
}