A loop for refreshing page that stop when a button/xpath is clickable

103 views Asked by At

trying to create a loop that refreshes the page continuously until button or xpath becomes available then it will break (dont bully my poor coding i'm new)


if Date == '1':
    bool (buttonActive) == False;
    list <WebElement> element = driver.find_element_by_xpath('//*[@id="booking-slots-slider"]/div[1]/button')
    while (buttonActive):
        if (element.size() > 0):
            buttonActive = True;
            element.get(0).click();
        else:
            driver.refresh()


        
            List<WebElement> add = driver.find_element_by_xpath('//*[@id="booking-slots-slider"]/div[1]/button')
0

There are 0 answers