diff --git a/pages/used_resources_page.py b/pages/used_resources_page.py index 6b7813a41b..913d645f9f 100644 --- a/pages/used_resources_page.py +++ b/pages/used_resources_page.py @@ -85,9 +85,20 @@ def get_links_href(self): return [link.get_attribute('href') for link in self.get_list_of_links()] @allure.step("Get status code of links in sections") - def get_links_status_codes(self): + def get_links_status_codes_brief(self): return [requests.head(link_href).status_code for link_href in self.get_links_href()] + @allure.step("Get status code of links in sections") + def get_links_status_codes(self): + status_codes = [] + links_href = self.get_links_href() + + for link_href in links_href: + link_status_code = requests.head(link_href).status_code + print(f'For the link: {link_href}, \nstatus code: {link_status_code}') + status_codes.append(link_status_code) + return status_codes + @allure.step("Click on links in sections and thereby open corresponding web pages on new tabs") def click_on_links(self): new_tabs = [link.click() for link in self.get_list_of_links()] diff --git a/test_data/used_resources_page_data.py b/test_data/used_resources_page_data.py index 313e155f75..e6ce6cea1d 100644 --- a/test_data/used_resources_page_data.py +++ b/test_data/used_resources_page_data.py @@ -25,7 +25,7 @@ class UsedResourcesPageData: "https://web.archive.org/web/20090601012031/http://caliban.mpiz-koeln.mpg.de/~stueber/" "thome/Alphabetical_list.html") - link_status_codes = (200, 301) + link_status_codes = (200, 301, 403) icons_xmlns = "http://www.w3.org/2000/svg"