Answer the question
In order to leave comments, you need to log in
Variable in xpath locator?
Good afternoon, there is such a serial_number variable that takes on a certain value
if you search for an element in this way:
find_serial_number = browser.find_element_by_xpath(".//*[contains(text(),'sn-12345']")
find_serial_number = browser.find_element_by_xpath(".//*[contains(text(),'sn-{0}'][' + serial_number']"
find_serial_number = browser.find_element_by_xpath(".//*[contains(text(),'sn-{0}'].format(serial_number)")
Answer the question
In order to leave comments, you need to log in
find_serial_number = browser.find_element_by_xpath(".//*[contains(text(),'"+serial_number+"')]")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question