RE: I have site , where multiple AddCart links are avialable for each product . Is there any way we can write common Method for Addcart Action ?

Ex :

Computer :

Addcart Button for HP : .//*[@id=’ProductForm_31′]/div[6]/input

Addcart Button for MAC : .//*[@id=’ProductForm_15′]/div[6]/input


movie1: .//*[@id=’ProductForm_37′]/div[8]/input

movie2 .//*[@id=’ProductForm_90′]/div[6]/input

My question is since each product have add cart Button [ex : flipkart] , how we can select Product X and Relating AddCart Button of X

Please help


Add Comment
3 Answers

You Just Compare there Xpath They Must be Differing with Some Index
movie1: .//*[@id=’ProductForm_37′]/div[8]/input    // index=8

movie2 .//*[@id=’ProductForm_90′]/div[6]/input    // index 6
Something Like This

Vice Professor Answered on November 24, 2014.
Add Comment

Your Answer

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