示例#1
0
class MainNavigation(object):
    def __init__(self, driver):
        self.driver = driver
        self.driver_waits = DriverWaits(self.driver)

    def go_to_all_courses_page(self):
        self.driver.find_element(*MainNavLocators.ALL_COURSES_LINK).click()
        self.driver_waits.wait_till_element_is_visible(
            CoursesPageLocators.COURSE_DIRECTORY)

        time.sleep(5)

    def go_to_home(self):
        self.driver.find_element(*MainNavLocators.BRAND_LOGO).click()
        self.driver_waits.wait_till_element_is_visible(
            HomePageLocators.COURSE_LIST_BLOCK)

    def logout(self):
        self.driver.find_element(*MainNavLocators.MY_PROFILE_ICON).click()

        self.driver_waits.wait_till_element_is_clickable(
            MainNavLocators.LOGOUT_LINK)
        time.sleep(1)
        self.driver.find_element(*MainNavLocators.LOGOUT_LINK).click()

        self.driver_waits.wait_till_element_is_visible(
            MainNavLocators.LOGIN_LINK)
示例#2
0
class LoginPage(object):
    def __init__(self, driver):
        self.driver = driver
        self.driver_waits = DriverWaits(self.driver)

    def login(self, credentials=settings.LOGIN_CREDENTIALS):
        self.driver.find_element(*MainNavLocators.LOGIN_LINK).click()
        self.driver_waits.wait_till_element_is_visible(
            LoginPageLocators.LOGIN_BUTTON)

        email_input = self.driver.find_element(*LoginPageLocators.EMAIL_INPUT)
        email_input.clear()
        email_input.send_keys(credentials['email'])

        password_input = self.driver.find_element(
            *LoginPageLocators.PASSWORD_INPUT)
        password_input.clear()
        password_input.send_keys(credentials['password'])

        self.driver_waits.wait_till_element_is_clickable(
            LoginPageLocators.LOGIN_BUTTON)
        self.driver.find_element(*LoginPageLocators.LOGIN_BUTTON).click()

        self.driver_waits.wait_till_element_is_visible(
            MainNavLocators.MY_PROFILE_ICON)
示例#3
0
class MainNavigation(object):

    def __init__(self, driver):
        self.driver = driver
        self.driver_waits = DriverWaits(self.driver)

    def logout(self):
        self.driver.find_element(*MainNavLocators.MY_PROFILE_ICON).click()

        self.driver_waits.wait_till_element_is_clickable(MainNavLocators.LOGOUT_LINK)
        time.sleep(1)
        self.driver.find_element(*MainNavLocators.LOGOUT_LINK).click()

        self.driver_waits.wait_till_element_is_visible(MainNavLocators.LOGIN_LINK)