def link_text(link_inner_text, wait_for_page=False): try: if wait_for_page: Wait.page_has_loaded() Wait.link_text(link_inner_text) session.ice_driver.find_element_by_link_text( link_inner_text).click() # If failed - count the failure and add the error to list of errors. except Exception as e: errorMsg = "Failed to click_on on LINK TEXT " + link_inner_text raise Exception(errorMsg, e)
def add_next_step_updated(checklistName, newFileName): Click.id(Constants.Dashboard.Checklist.AddNS.ID) Wait.id(Constants.Dashboard.Modal.CLOSE_BUTTON_ID) Wait.text_by_css("span.font_header.ng-binding", "Checklist:") Wait.text_by_css("h2.ng-binding", "Add Next Steps") # First NS Click.id("description") Enter.text_by_id("description", "description of NS") Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[10]") Click.link_text(newFileName) Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[11]") try: Click.xpath("//div[3]/multiselect/div/ul/li/a") except BaseException: Wait.link_text("Homer Simpson") Click.link_text("Homer Simpson") Wait.css("div.modal-content") Click.css("div.modal-content") Wait.xpath("(//button[@type='button'])[12]") count = 0 FEWizard.date_picker_add_ns(count) count = +1 Click.css("span.add-text") Click.xpath("(//div[@id='description'])[2]") Enter.text_by_xpath("(//div[@id='description'])[2]", "description of NS2") Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[14]") Click.xpath("(//button[@type='button'])[22]") Click.xpath("//div[3]/div/div[2]/multiselect/div/ul/li[2]/a") Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[23]") Click.css("div.btn-group.open > ul.dropdown-menu > " + "li.ng-scope > a.ng-binding") Click.link_text("Add Another Next Step") Wait.xpath("(//button[@type='button'])[25]") Click.xpath("(//button[@type='button'])[25]") Wait.xpath("(//button[@type='button'])[24]") FEWizard.date_picker_add_ns(count) Wait.xpath("//div[4]/div/span") Click.xpath("//div[4]/div/span") Wait.id("btn-submit") Wait.text_by_id("btn-submit", "Submit Next Steps") Click.id("btn-submit")
def text_by_link_text( attr_link_text_value, typed_text, wait_for_page=False): # Send keys to element in UI, by name locator (e.g. type something in # text box). try: if wait_for_page: Wait.page_has_loaded() Wait.link_text(attr_link_text_value) session.ice_driver.find_element_by_link_text( attr_link_text_value).clear() session.ice_driver.find_element_by_link_text( attr_link_text_value).send_keys(typed_text[:-1]) time.sleep(session.wait_until_time_pause) session.ice_driver.find_element_by_link_text( attr_link_text_value).send_keys(typed_text[-1:]) # If failed - count the failure and add the error to list of errors. except Exception: errorMsg = "Failed to type " + typed_text + " in text box" raise Exception(errorMsg, attr_link_text_value)