Pravin
Pravin

Reputation: 145

selenium ide having problems with dynamic id

i am testing our web based application using selenium. I am having problem in a button which has dynamic id and the class is similar to the last html page so i am unable to go ahead with the testing. below is the source of the button

input id="aui_3_4_0_1_554" class="addto_cart_button" type="button" onclick="chkMaxRequestPerDay();" value="Request Quote">

I want to know how can i tell selenium ide to check with value so that it can proceed

Thanks

Upvotes: 0

Views: 418

Answers (2)

A Paul
A Paul

Reputation: 8251

I think something like below should also work

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

or

//input[@class='addto_cart_button']

this will give you a List loop through them and in the loop check

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

Upvotes: 0

Amith
Amith

Reputation: 7008

you can try using xpath with value,

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

or

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

Upvotes: 1

Related Questions