Get the number of posts from the profile screen
(browser)
| 1146 | |
| 1147 | |
| 1148 | def get_number_of_posts(browser): |
| 1149 | """Get the number of posts from the profile screen""" |
| 1150 | try: |
| 1151 | num_of_posts = getUserData( |
| 1152 | "graphql.user.edge_owner_to_timeline_media.count", browser |
| 1153 | ) |
| 1154 | except WebDriverException: |
| 1155 | try: |
| 1156 | num_of_posts_txt = browser.find_element( |
| 1157 | By.XPATH, read_xpath(get_number_of_posts.__name__, "num_of_posts_txt") |
| 1158 | ).text |
| 1159 | |
| 1160 | except NoSuchElementException: |
| 1161 | num_of_posts_txt = browser.find_element( |
| 1162 | By.XPATH, |
| 1163 | read_xpath( |
| 1164 | get_number_of_posts.__name__, "num_of_posts_txt_no_such_element" |
| 1165 | ), |
| 1166 | ).text |
| 1167 | |
| 1168 | num_of_posts_txt = num_of_posts_txt.replace(" ", "") |
| 1169 | num_of_posts_txt = num_of_posts_txt.replace(",", "") |
| 1170 | num_of_posts = int(num_of_posts_txt) |
| 1171 | |
| 1172 | return num_of_posts |
| 1173 | |
| 1174 | |
| 1175 | def get_relationship_counts(browser, username, logger): |
no test coverage detected