def get_related_row_data(row): try: row_fields = get_direct_children(row) related_document = f'{title_strip(row_fields[4].text)} {title_strip(row_fields[3].text)} {(row_fields[8].text)}' # print("related_document", related_document) return related_document except StaleElementReferenceException: print("Encountered a stale element reference exception, trying again") return None
def access_notes(browser, abstract, document): notes_container = locate_element_by_id(browser, abstract.county.record["Notes"], "notes", False, document) notes_text = get_direct_children(notes_container)[2].text if notes_text.startswith('Legals'): return list_to_string(notes_text.split('\n')[1:]) elif notes_text.startswith('Notes'): return list_to_string(notes_text.split(' ')[1:], False) else: input( 'Unexpected result while parsing notes, please review and update accordingly...' )
def get_search_results(main_table): return get_direct_children(get_direct_children(main_table)[2])
def get_result_type(result): return get_element_text(get_direct_children(result)[2])
def get_result_number(result): # Create a similar function for matching book / page numbers return get_direct_children(result)[8]
def get_related_documents_rows(related_documents_table): related_documents_sub_tables = related_documents_table.find_elements_by_tag_name( table_body_tag) related_documents_data = related_documents_sub_tables[4] return get_direct_children(related_documents_data)