Locating Identical Elements (Python)

Locating Identical Elements (Python)

To differentiate between elements with the same attributes and tag name, you can specify which number element you are referring as shown here:

driver.find_element(By.XPATH, "(//p[@class='title-white'])[2]")

This will retrieve the 2nd element on the page with the tag name p and the class title-white.

See Working Example

Using Java

Leave a reply

Your email address will not be published. Required fields are marked*

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.