dimanche 25 octobre 2020

Python Selenium dynamic condition

I'm doing automation with selenium but I'm having trouble finding an element. I really thought this is because dynamic elements. Sometimes it displays "You found 0" or "You found 1". Here is the html code image Here is my code right now about it

ele = driver.find_element_by_xpath("//*[@class='swal-text' and (contains(text(),'You found 4'))]").is_displayed()
if (ele):
    print("4 ")
else:
    pass

The error says if it's not found, can you help me guys, please Python 3.9.0

Aucun commentaire:

Enregistrer un commentaire