RE: How to click on particular button?.

Hi,

How to click on particular button?, when the all identifiers are same?.

Please find the below Screenshot, HTML and application URL.

Image:

RE: How to click on particular button?.

HTML:


<input type="submit" class="wpsc_buy_button" name="Buy" value="Add To Cart">

URL:
http://store.demoqa.com/products-page/product-category/accessories/

Rocky Doctor Asked on September 7, 2014 in Selenium WebDriver.
Add Comment
6 Answers

hi
Use Indexing in Your Xpath
example
xpath=(//input[@value=’add to cart’])[index number]

Check Index Number For Your Element on Firepath

thanks
ankit

Vice Professor Answered on September 8, 2014.

Thanks Ankit, I can also write xpath but I am looking for generic code because the reason is this will be useful when dealing with eCommerce application. Here we will be having lot of buttons so. But thanks for your time.

Thanks for your time Ankit.

on September 8, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.