Find all elements with specified xpath rather than just the first

Viewed 20

Currently I have

XPATH = "//*[contains(@id, 'id__')]/div[3]/div/div"
elem = driver.find_element("xpath", XPATH)

The XPATH uses contains as the id in the xpath is randomized, there is multiple elements with this same structure so it picks the first one it finds and ignores the rest. How can I make it so it grabs every element with this?

1 Answers
elem = driver.find_elements("xpath", XPATH)
print(elem[0])
Related