jeudi 25 novembre 2021

how do i use the python if \ else function in Appium if the button doesn't appear on the screen until a certain point

I have a function that makes swipes until the "Continue" button appears on the screen. I still can't figure out how to use it in if \ else. I constantly get an error

My code is below-

if drv == driver:
    while True:
        x_one = random.randint(84, 291)
        y_one = random.randint(283, 505)
        x_two = random.randint(84, 291)
        y_two = random.randint(283, 505)
        drv.swipe(x_one, y_one, x_two, y_two, 100)
        elements = drv.find_element_by_xpath("//XCUIElementTypeButton[@name=\"Продолжить\"]")
        if len(elements) != 0:
            break
    drv.find_element_by_accessibility_id("Продолжить").click()

Aucun commentaire:

Enregistrer un commentaire