samedi 1 avril 2017

if else loop on Python. Checking a class name with Selenium

I have this appointment system where i have to wait till the link is available. If this link its availble then click it. If not back and foward (beacause the page doesn't let me reload ). And check it again till is available.

while True:

    if driver.find_element_by_class_name("linkButton"):

            #do somthing



    else:

             driver.back()
             driver.forward()
             #check again.

The program doesn't throw any error but when i force the if to be false the else just do nothing.

I can't check it with the link that is not available because in the page is till available that's why i force the if to be false

Aucun commentaire:

Enregistrer un commentaire