Blackboard-marks/utils/wait.py

16 lines
519 B
Python
Raw Normal View History

2022-11-26 15:51:00 +08:00
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
timeout = 10
2022-11-26 15:51:00 +08:00
def WaitClickable(driver, locator):
return WebDriverWait(driver, timeout).until(EC.element_to_be_clickable(locator))
def WaitDiv(driver, locator):
return WebDriverWait(driver, timeout).until(EC.presence_of_element_located(locator))
def SwitchToIFrame(driver, locator):
return WebDriverWait(driver, timeout).until(EC.frame_to_be_available_and_switch_to_it(locator))