Asynchronous WebDriverWait until in Python's selenium

Viewed 106

I have different tabs in a webdriver. I want to asynchronously switch between them based on wait_until, i.e. switch the tab when WebDriverWait until's condition at some tab is True.

Sample code:

class Tab:
    def action():
        WebDriverWait(driver, 10).until(ec.visibility_of_element_located((By.ID, 123)))


def run_tabs(driver, tabs):
    [tab.action() for tab in tabs]


tabs = [Tab() for _ in range(10)]
driver = Webdriver(<...>)
run_tabs(driver, tabs)

I don't want to create a new driver for each tab.

Thanks in advance!

0 Answers
Related