CoolFace
Apppublic

UP20/puppet-staging

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
utils.py28 linesDownload Raw Back to tests
1from selenium.webdriver.remote.webdriver import WebDriver2from selenium.common.exceptions import TimeoutException3 4 5def wait_for_element(6    driver: WebDriver, by_selector: str, selector_value: str, timeout: int = 27):8    from selenium.webdriver.support.wait import WebDriverWait9    from selenium.webdriver.support import expected_conditions as EC10 11    element = None12 13    try:14        element = WebDriverWait(driver, timeout).until(15            EC.presence_of_element_located((by_selector, selector_value))16        )17 18    except TimeoutException:19        element = None20    finally:21        return element22 23 24def find_and_click(driver: WebDriver, by_selector: str, selector_value: str):25    element = driver.find_element(by=by_selector, value=selector_value)26    if element:27        element.click()28