Пример #1
0
def step(context, property, text):
    time.sleep(5)
    try:
        wait_for_element("//*[contains(@" + property + ", '" + text + "')]",
                         context.driver)
        element = context.driver.find_element_by_class_name(text)
        assert element.is_displayed()
        # print(element.text)
    except Exception as e:
        print(e)
        assert False
Пример #2
0
def step(context, street_address):
    context.user_funnel_info['address'] = street_address
    addressFormXpath = "//input[@id='garaging_addressInput']"
    wait_for_element_to_load_and_enter_text_into_element(
        addressFormXpath, street_address, context.driver)
    try:
        # Wait for the drop down menu to show and click to close it
        xpath = "//div[@id='PlacesAutocomplete__autocomplete-container']"
        wait_for_element(xpath, context.driver)
        wait_for_element_to_load_and_click_on_element(xpath, context.driver)
        # element = wait_element_present_and_find(context.driver, xpath)
    except:
        pass
Пример #3
0
def step(context, text, field):
    xpath = "//input[@placeholder='" + field + "']"
    wait_for_element(xpath, context.driver)
    context.driver.find_element_by_xpath(xpath).send_keys(text)
Пример #4
0
def step(context, page):
    insuranceYesXpath = '//span[text()="Yes, I have insurance"]//ancestor::button[@class="button-anim btn btn-secondary btn-wide"]'
    wait_for_element(insuranceYesXpath, context.driver)
    assert context.driver.find_element_by_xpath(insuranceYesXpath).is_displayed()
    context.driver.quit()
Пример #5
0
def step(context, button, step_descriptor):
    brief_wait()
    xpath = "*//span[text()='" + button + "']"
    wait_for_element(xpath, context.driver)
    edit_list = context.driver.find_elements_by_xpath(xpath)
    edit_list[1].click()
Пример #6
0
def step(context, button):
    brief_wait()
    xpath = "//span[text()='2 Drivers']/ancestor::*[position()=1]//span[text()='Edit']"
    wait_for_element(xpath, context.driver)
    context.driver.find_element_by_xpath(xpath).click()
def step(context, field):
    xpath = '*//span[text()="' + field + '"]'
    wait_for_element(xpath, context.driver)
    pageText = context.driver.find_element_by_xpath(xpath).text
    assert pageText == field, 'Page text:' + pageText
Пример #8
0
def step(context, section, text):
    xpath = '//*[@id="' + section + '"]//*[@class="form-control"]'
    wait_for_element(xpath, context.driver)
    selectedMenuItem = context.driver.find_element_by_xpath(xpath)
    assert selectedMenuItem.get_attribute(
        'placeholder') == text, selectedMenuItem.get_attribute('placeholder')
Пример #9
0
def step(context, category, button_name):
    xpath = '//*[@id="' + prepop_locators[
        category] + '"]//button[@class="button-anim active btn btn-secondary btn-wide active"]'
    wait_for_element(xpath, context.driver)
    selectedButton = context.driver.find_element_by_xpath(xpath)
    assert selectedButton.text == button
Пример #10
0
def step(context, section, button):
    xpath = '//*[@id="' + section + '"]//button[@class="button-anim active btn btn-secondary btn-wide active"]'
    wait_for_element(xpath, context.driver)
    selectedButton = context.driver.find_element_by_xpath(xpath)
    assert selectedButton.text == button