def open_document_link(browser, link): javascript_script_execution(browser, link) if not assert_window_title(browser, document_description_title): print( f'Browser failed to return to "{document_description_title}" page, trying again.' ) browser.back() # short_nap() javascript_script_execution(browser, link)
def open_search(browser, abstract, document): javascript_script_execution(browser, abstract.county.scripts["Search"]) navigation_tab = access_search_navigation_tab(browser, abstract, document) while not is_active_class(navigation_tab): print("Navigation tab not active, attempting to connect again.") naptime() # Allows time for navigation to load navigation_tab = access_search_navigation_tab(browser, abstract, document) assert abstract.county.titles["Search"]
def open_result(browser, document): search_results = locate_element( browser, document.search_attributes["Results Table Id"], "search results", document=document) result_script = get_direct_link( locate_elements_by_tag_name(search_results, result_link_tag_name, "result link", True, document)[1]) javascript_script_execution(browser, result_script)
def open_result_link(browser, document, result): try: document_link = get_result_link(result, document) document.description_link = document_link javascript_script_execution(browser, document.description_link) return True except TimeoutException: print(f'Browser timed out trying to open result link for ' f'{document.extrapolate_value()}, please review') input() return False
def open_search(browser, abstract): # Messy => figure out a better way to do this javascript_script_execution(browser, abstract.county.scripts["Search"]) naptime() # This will probably not work great when called during the 'login' process ###### search_navigation = locate_element_by_id( browser, abstract.county.ids["Search Navigation"], "search navigation", True) if is_active_class(search_navigation): return else: browser.execute_script(abstract.county.scripts["Search"]) assert abstract.county.titles["Search"]
def handle_disclaimer(browser, abstract): javascript_script_execution( browser, abstract.county.scripts["Open Search"] ) disclaimer = locate_element_by_id(browser, abstract.county.ids["Disclaimer"], "disclaimer" ) if disclaimer.get_attribute('class') == abstract.county.classes["Disclaimer Active"]: click_button( browser, locate_element_by_id, abstract.county.buttons["Disclaimer"], "disclaimer button" ) naptime()
def open_document(browser, abstract, document): if not document.description_link or document.result_number > 0: collect(browser, abstract, document) javascript_script_execution(browser, document.description_link) return True
def execute_search(browser): javascript_script_execution(browser, execute_document_search_script)
def execute_search(browser, abstract): switch_to_search_menu_frame(browser, abstract) javascript_script_execution(browser, abstract.county.scripts["Search"])
def handle_disclaimer(browser): switch_to_main_frame(browser) javascript_script_execution(browser, disclaimer_script)
def execute_login(browser): javascript_script_execution(browser, login_script) assert_window_title(browser, post_login_title)
def log_out_user(browser): switch_to_default_content(browser) javascript_script_execution(browser, logout_script)
def open_document_download_page(browser, document): javascript_script_execution(browser, document.image_link) if not assert_window_title(browser, document_image_title): print(f'Browser failed to open document download page for ' f'{extrapolate_document_value(document)}, please review.')
def handle_disclaimer(browser, abstract): switch_to_main_frame(browser, abstract) javascript_script_execution(browser, abstract.county.scripts['Disclaimer'])