def check_result(browser, abstract, document, results_table): first_result = access_first_row(abstract, document, results_table) center_element(browser, first_result) first_result_cells = first_result.find_elements_by_tag_name( abstract.county.tags["Data"]) if document.value in map(get_element_text, first_result_cells): return True
def center_purchase_button(browser, abstract, document): purchase_button = locate_element_by_class_name( browser, abstract.county.classes["Purchase Button"], "purchase button", clickable=True, document=document) center_element(browser, purchase_button)
def access_results_table(browser, abstract, document): results = locate_element_by_id(browser, abstract.county.ids["Results Table"], "results table", False, document) center_element(browser, results) results_table = locate_element_by_tag_name( results, abstract.county.tags["Table Body"], "results table body", False, document) return results_table
def open_search_tab(browser, abstract): search_tab = locate_element_by_id(browser, abstract.county.ids["Search Tab"], "search tab", True) center_element(browser, search_tab) if is_active_class(get_parent_element(search_tab)): return else: search_tab.click()
def get_related_documents_table_rows(browser, abstract, document_table, document): center_element(browser, document_table) related_documents_table_rows = locate_related_documents_table_rows( abstract, document, document_table) while related_documents_table_rows is False: print(f'Unable to locate the "Related Documents Table" rows for ' f'{document.extrapolate_value()}, trying again...') naptime() related_documents_table_rows = locate_related_documents_table_rows( abstract, document, document_table) return related_documents_table_rows
def click_button(browser, locator_function, attribute, type, document=None): try: button = locator_function(browser, attribute, type, True, document) if button is False: return False else: center_element(browser, button) button.click() except ElementClickInterceptedException: # handles an issue with eagle downloads print( f'Element click intercepted while trying to click "{type}" ' f'attribute "{attribute}", please review and press enter to continue...' ) input() return False
def next_search_results_page(browser, abstract, document): # A better idea would be to check the recorded results vs. the result count try: next_button = browser.find_element_by_link_text('Next') center_element(browser, next_button) next_button.click() sleep(10) except NoSuchElementException: print("No more pages!") print( f'Recorded {len(abstract.dataframe["Grantor"])} during processing.' ) return except ElementClickInterceptedException: print("No more pages!") print( f'Recorded {len(abstract.dataframe["Grantor"])} during processing.' ) return
def open_informational_link( browser, link): # needs to be updated to work on a smaller screen center_element(browser, link) link.click()
def add_to_cart(browser, document): add_to_cart_form = locate_add_to_cart_form(browser, document) center_element(browser, add_to_cart_form) add_to_cart_form.submit() return True