[Solved] How to locate an element which have same name and same atrributes in different tags in selenium

[ad_1]

Use it like this:

By.xpath((.//*[@id='123'])[2])

the xpath should be in braces. The [2] at the end denotes the index. i.e. [1] will be the first div tag, [2] will be the second div tag.

I have encountered this issue lot of times. This happens in many websites.

[ad_2]

solved How to locate an element which have same name and same atrributes in different tags in selenium