Hi Team,
The video says Multiple elements can have same xpath, but in he explanation example I can see that for Buy Now div is changing like div[1], div[2]
Please can you help me with the same
There is always a chance to have multiple elements with same xpath. Example: table/tbody/tr
In a table, we have multiple rows with same xpath. To extract each row into a list we need to identify them by iterating over the tr tags with there index.
Example:
//table/tbody/tr[1]
//table/tbody/tr[2]
.
.
//table/tbody/tr[n]
Similarly for 'Buy Now' there can be mutliple elements with same xpath but based on there indexes selenium can identify the precise button among them.
Okay Raj, Thank you for the response