Exemplo n.º 1
0
def main():

    user_input = parser()
    login()
    problems = validator(user_input[0], user_input[1])
    checker(user_input[0], problems)
    if results_in_terminal is True:
        results(problems)
    if headless is True:
        driver.quit()
Exemplo n.º 2
0
def login():
    # log in to the intranet
    print('logging in...')
    try:
        driver.get('https://intranet.hbtn.io')
        driver.find_element_by_id('user_login').send_keys(email)
        driver.find_element_by_id('user_password').send_keys(password)
        driver.find_element_by_name('commit').click()
        WebDriverWait(driver, 15).until(
            EC.visibility_of_element_located((By.CLASS_NAME, 'signed_in')))
    except TimeoutException:
        print('login failed.')
        driver.quit()
        exit()
Exemplo n.º 3
0
from selenium.webdriver.common.by import By
from config import driver


class PasswordRecoveryPage:
    def __init__(self, driver):
        driver.get("https://courses.ultimateqa.com/users/password/new")
        self.email_field = driver.find_element(By.XPATH, "//input[@type='email' and @placeholder='Email']")
        self.submit_btn = driver.find_element(By.XPATH, "//input[@type='submit']")

    def email_recovery(self):
        email = input("Enter the email you want to recovery: ")
        self.email_field.send_keys(email)
        self.submit_btn.click()
        test_name = "Email recovering."
        try:
            driver.find_element(By.XPATH, "//h1[contains(text(),'Help is on the way')]")
            print(
                f"Test: {test_name}\nStatus: Passed.\nTo fully pass this test you should to check your email: {email}")
        except:
            print(f"Test: {test_name}\nStatus: Failed")


if __name__ == '__main__':
    PasswordRecoveryPage(driver).email_recovery()
driver.quit()