Exemplo n.º 1
0
def step_username(selenium_client, username, domain):
    # Wizard - step 1
    log_write(selenium_client, By.NAME, "MemberName", username)
    log_click(selenium_client, By.ID, "LiveDomainBoxList")
    select_value(selenium_client, By.ID, "LiveDomainBoxList", domain)
    log_click(selenium_client, By.ID, "iSignupAction")
    logger.info("Submitted wizard for step 1")
Exemplo n.º 2
0
def step_phone_verification(selenium_client, sms_receiver):
    # Wizard - step 6 - phone verification (optional)
    logger.info("Submitted wizard for step 4")
    phone = phonenumbers.parse(sms_receiver.get_phone_number())
    country = region_code_for_country_code(phone.country_code)
    select_value(
        selenium_client,
        By.XPATH,
        "//div[@id='wlspispHipChallengeContainer']//select",
        country,
    )
    log_write(
        selenium_client,
        By.XPATH,
        "//div[@id='wlspispHipChallengeContainer']//input",
        phone.national_number,
    )
    log_click(
        selenium_client,
        By.XPATH,
        "//div[@id='wlspispHipControlButtonsContainer']//a[@title='Send SMS code']",
    )
    validate_error(selenium_client, "Code error")
    text = sms_receiver.get_latest_sms(phone)
    code = text.split(":")[1].strip()
    log_write(
        selenium_client,
        By.XPATH,
        "//label[@id='wlspispHipSolutionContainer']//input",
        code,
    )
    log_click(selenium_client, By.ID, "iSignupAction")
Exemplo n.º 3
0
def step_name(selenium_client, first_name, last_name):
    # Wizard - step 3
    log_wait(selenium_client, By.NAME, "FirstName")
    log_write(selenium_client, By.NAME, "FirstName", first_name)
    log_wait(selenium_client, By.ID, "LastName")
    log_write(selenium_client, By.ID, "LastName", last_name)
    log_click(selenium_client, By.ID, "iSignupAction")
    logger.info("Submitted wizard for step 3")
Exemplo n.º 4
0
def step_personal(selenium_client, country, birth_date):
    # Wizard - step 4
    log_wait(selenium_client, By.NAME, "Country")
    select_value(selenium_client, By.NAME, "Country", country)
    select_value(selenium_client, By.NAME, "BirthMonth", str(birth_date.month))
    select_value(selenium_client, By.NAME, "BirthDay", str(birth_date.day))
    select_value(selenium_client, By.NAME, "BirthYear", str(birth_date.year))
    log_click(selenium_client, By.ID, "iSignupAction")
    logger.info("Submitted wizard for step 3")
Exemplo n.º 5
0
def step_captcha(selenium_client, captcha_client):
    # Wizard - step 5
    visual_xpath = "//img[@alt='Visual Challenge']"
    locator = (By.XPATH, visual_xpath)
    log_wait(selenium_client, *locator)
    WebDriverWait(selenium_client,
                  60).until(EC.presence_of_element_located(locator))
    WebDriverWait(selenium_client, 60).until(image_has_been_loaded(locator))
    image = selenium_client.find_element(By.XPATH,
                                         visual_xpath).screenshot_as_png
    captcha_text = solve_captcha(captcha_client, image)
    selenium_client.find_element_by_xpath(
        "//label[@id='wlspispHipInstructionContainer']/..//input[@type='text']"
    ).send_keys(captcha_text)
    log_click(selenium_client, By.ID, "iSignupAction")
    validate_error(selenium_client, "Captcha error")
    logger.info("Submitted wizard for step 5")
Exemplo n.º 6
0
def step_password(selenium_client, password):
    # Wizard - step 2
    log_wait(selenium_client, By.NAME, "Password")
    log_write(selenium_client, By.NAME, "Password", password)
    log_click(selenium_client, By.ID, "iSignupAction")
    logger.info("Submitted wizard for step 2")
Exemplo n.º 7
0
def open_form(selenium_client):
    log_wait(selenium_client, By.CLASS_NAME, "sign-in-link")
    log_click(selenium_client, By.CLASS_NAME, "sign-in-link")
    log_wait(selenium_client, By.ID, "signup")
    log_click(selenium_client, By.ID, "signup")
    logger.info("Started wizard")