AS per the screen shot there are more then two botton of the add to cart and all button class name are same . so how can i identify the each and every one by the on click event->ajax id enter image description here
1 Answer 1
Without the full DOM structure, I would guess by the UI:
Probably there is a root where the two button elements derive uniquely.
Some common node
└── ├── Image Node
├── Image tag
└── Button tag
├── QR Code Node
├── QR Code tag
└── Button tag
So, if you want to reach the image input, your css selector is .css_class_of_the_image_node input. If you want to reach the image input, your css selector is .css_class_of_the_QR_code_node input.
-
To be fully complete, the css selectors would be
.css_class_of_the_image_node input .product-box-add-to-cart-button
or.css_class_of_the_QR_code_node input .product-box-add-to-cart-button
Pieter A– Pieter A2018年05月17日 06:27:46 +00:00Commented May 17, 2018 at 6:27 -
I think input.product-box-add-to-cart-button is the case, since the product-box-add-to-cart-button is a class of the input elements. Using as you suggested would search for a element which has the named class INSIDE the input element - thus would find nothing because there is nothing inside input elements.João Farias– João Farias2018年05月20日 12:37:07 +00:00Commented May 20, 2018 at 12:37
-
1Sorry, I totally missed the 'input' part, also when copy pasting. Your original solution was correct and also agree with your last comment.Pieter A– Pieter A2018年05月20日 13:04:48 +00:00Commented May 20, 2018 at 13:04
className
wont work. use this//input[@class='button-2 product-box-add-to-cart-button']
and let me know