Extract username of a follow button from a dialog box
(buttons)
| 833 | |
| 834 | |
| 835 | def dialog_username_extractor(buttons): |
| 836 | """Extract username of a follow button from a dialog box""" |
| 837 | |
| 838 | if not isinstance(buttons, list): |
| 839 | buttons = [buttons] |
| 840 | |
| 841 | person_list = [] |
| 842 | for person in buttons: |
| 843 | if person and hasattr(person, "text") and person.text: |
| 844 | try: |
| 845 | xpath = read_xpath(dialog_username_extractor.__name__, "person") |
| 846 | element_by_xpath = person.find_element(By.XPATH, xpath) |
| 847 | elements_by_tag_name = element_by_xpath.find_elements(By.TAG_NAME, "a")[ |
| 848 | 0 |
| 849 | ].text |
| 850 | |
| 851 | if elements_by_tag_name == "": |
| 852 | elements_by_tag_name = element_by_xpath.find_elements( |
| 853 | By.TAG_NAME, "a" |
| 854 | )[1].text |
| 855 | |
| 856 | person_list.append(elements_by_tag_name) |
| 857 | except IndexError: |
| 858 | print("how many?") |
| 859 | pass # Element list is too short to have a [1] element |
| 860 | |
| 861 | return person_list |
| 862 | |
| 863 | |
| 864 | def follow_through_dialog( |
nothing calls this directly
no test coverage detected