def click_secondary_module_link()

in pages/desktop/frontend/home.py [0:0]


            def click_secondary_module_link(self):
                link = self.find_element(*self._module_link_locator)
                target = link.get_attribute("target")
                # external links are opened in new tabs, so we need to account for multiple windows
                if target == "_blank":
                    link.click()
                    self.wait.until(EC.number_of_windows_to_be(2))
                    new_tab = self.driver.window_handles[1]
                    self.driver.switch_to.window(new_tab)
                    # editorial might change these links when they need to push new content and we don't know
                    # in advance what that content might be; also, we want to avoid frequent maintenance for
                    # these tests; the solution used is to verify that the content we link to is available
                    # (i.e. we check that the page response status is 200)
                    self.wait.until(custom_waits.url_not_contains("about:blank"))
                    page = requests.head(self.driver.current_url)
                    assert (
                        page.status_code == 200
                    ), f"The response status code was {page.status_code}"
                else:
                    # this condition handles links that open on the amo domain; again, we might not know the
                    # content in advance, so the best we can do is check that the page opens in AMO
                    # and the status code we receive is 200
                    link.click()
                    self.wait.until(
                        EC.invisibility_of_element_located(
                            (By.CLASS_NAME, "LoadingText")
                        )
                    )
                    assert "addons" in self.driver.current_url
                    page = requests.head(self.driver.current_url)
                    assert (
                        page.status_code == 200
                    ), f"The response status code was {page.status_code}"