Answer the question
In order to leave comments, you need to log in
Python Selenium work with find_element_by_xpath check?
Hello, I just started getting acquainted with Selenium, read the docks on the site and could not find the design I needed.
Task: the script goes to the target page and searches, if it finds it clicks (if not, it breaks)
driver.find_element_by_xpath(u"//img[@alt='Спасибо']").click()
Answer the question
In order to leave comments, you need to log in
Found the solution myself =_=
try:
driver.find_element_by_xpath(u"//img[@alt='Спасибо']").click()
driver.back()
except:
driver.back()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question