Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
573 B
1
Indexable
Never
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class BasePage:
    def __init__(self, driver):
        self.driver = driver
        self.wait = WebDriverWait(self.driver, 5)

    def is_visible(self, by_locator):
        try:
            element = self.wait.until(EC.visibility_of_element_located(by_locator))
            return bool(element)
        except:
            return False

    def click_element(self, by_locator):
        self.wait.until(EC.element_to_be_clickable(by_locator)).click()
Leave a Comment