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
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
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)
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()
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()
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
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')
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
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