Пример #1
0
def set_random_state_dropdown():
    try:
        click_element(get_element_by_css('select#profile_state'))
        states = get_element_by_css('select#profile_state').text.split('\n')
        if (len(states)) < 51:
            raise ValueError('ERROR: did not find 51 states')
        random_state = states[random.randrange(len(states))]
        state_index = states.index(random_state)
        for _ in xrange(state_index):
            simulate_keys(get_element_by_css('select#profile_state'), 'DOWN')
        simulate_keys(get_element_by_css('select#profile_state'), 'ENTER')
        test_print('clicking state = "{0}"'.format(random_state))
    except:
        random_state = 'AL'
    return random_state
def set_random_state_dropdown():
    try:
        click_element(get_element_by_css('select#profile_state'))
        states = get_element_by_css('select#profile_state').text.split('\n')
        if (len(states)) < 51:
            raise ValueError('ERROR: did not find 51 states')
        random_state = states[random.randrange(len(states))]
        state_index = states.index(random_state)
        for _ in xrange(state_index):
            simulate_keys(get_element_by_css('select#profile_state'), 'DOWN')
        simulate_keys(get_element_by_css('select#profile_state'), 'ENTER')
        test_print('clicking state = "{0}"'.format(random_state))
    except:
        random_state = 'AL'
    return random_state
Пример #3
0
def click_element_by_xpath(xpath, multiple=False, wait=True):
    """
    Click the element given by the xpath.

    @param multiple: if True, allow multiple elements and click the first one.
    @param wait:     if True, wait for a page with body element available.
    """
    elements = a.get_elements_by_xpath(xpath)

    if len(elements) == 0:
        raise AssertionError, "Could not identify element: 0 elements found"

    if len(elements) > 1 and not multiple:
        raise AssertionError, \
            "Could not identify element: %d elements found" % len(elements)

    element = elements[0]

    a.click_element(element, wait=wait)
Пример #4
0
def set_update_personal_button():
    click_element(
        wait_for_element(ps='clicking "Update Personal" button',
                         css_select='input.btn.btn-primary'))
Пример #5
0
def set_sign_up_button():
    click_element(wait_for_element(value="Sign up"))
    test_print('clicking the "Sign up" button')
Пример #6
0
def set_log_in_button():
    click_element(wait_for_element(value="Log in"))
    test_print('clicking the "Log in" button')
def set_update_personal_button():
    click_element(wait_for_element(ps='clicking "Update Personal" button', css_select='input.btn.btn-primary'))
Пример #8
0
    check = a.get_element_by_xpath("//input[@id='shipping:same_as_billing']")
    a.wait_for(a.assert_displayed, check)
    check.click()
    # we need the right continue button, so roll by hand
    button = a.get_element_by_xpath(
        "//form[@id='co-shipping-form']//button[@title='Continue']")
    button.click()

a.wait_for(a.assert_displayed, 'checkout-step-shipping_method')

a.click_button(a.get_element_by_xpath(
    "//div[@id='checkout-step-shipping_method']"
    "//button"))

a.wait_for(a.assert_displayed, 'p_method_getfinancing')
a.click_element(a.get_element(id='p_method_getfinancing'))
a.click_button(a.get_element_by_xpath(
    "//div[@id='checkout-step-payment']"
    "//button"))

# go through gf process
a.set_wait_timeout(60.0)

a.wait_for(a.switch_to_frame, 'popup')
a.wait_for(a.assert_displayed, 'id_ssn4')
a.write_textfield('id_ssn4', '6220')
a.click_element('id_agree')
a.click_button('submit-id-btn_find')

# we could either adopt the loan or start from scratch; check
el = a.wait_for(common.get_elements_multiple, [