mercredi 22 janvier 2020

How to check if the text field conains inputed text in Python Selenium Webdriver

I tried to use some assert statements but it everytime fails.

button_test1 = driver.find_elements_by_xpath('//*[@class="custom-select"]')[0]
button_test1.click()

time.sleep(2)

button_test2 = driver.find_elements_by_xpath('//*[contains(text(),"Box Sport Žilina")]')[0]
button_test2.click()

time.sleep(2)

element = driver.find_element_by_xpath('//*[contains(text(),"Box Sport Žilina")]').text

time.sleep(2)

assert element == "Box Sport Žilina"

Aucun commentaire:

Enregistrer un commentaire