Python Selenium can't find XPath

Viewed 46

I need to find the XPath for the Text (Can you find me?): enter image description here

Tried it for about 10 minutes but wasn't able to do it.

1 Answers

You have id, use it.

driver.find_element_by_id("modal-root-header").text

If id is not unique for some reason, use xpath:

driver.find_element_by_xpath("//h4[@id='modal-root-header']").text

If .text won't work, try .get_attribute("value"), or .get_attribute("innerText")

Related