Skip to content

Commit 23b4dd3

Browse files
Merge pull request #556 from Brain-up/issue_268
Issue_268_HEADER_links
2 parents a41e4b2 + 7f8f129 commit 23b4dd3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pages/header_page.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Methods for verifying web elements in the Header of the site"""
2-
import time
32
import allure
43
import requests
54
from selenium.webdriver.support import expected_conditions as EC
@@ -352,16 +351,18 @@ def click_on_internal_links_in_header_auth(self):
352351
opened_pages = []
353352
# Click on the 'Statistics', 'Groups', 'About', 'Profile', 'Logo' links
354353
for link in self.get_list_of_direct_internal_links_auth():
354+
current_url = self.get_current_tab_url()
355355
link.click()
356-
time.sleep(1)
356+
Wait(self.driver, 10).until(EC.url_changes(current_url))
357357
opened_pages.append(self.get_current_tab_url())
358358
# Click on the 'Contacts', 'Specialists', 'Contributors', 'Used Resources' links
359359
for link in self.get_list_of_internal_links_in_more():
360360
self.click_more_button()
361-
time.sleep(1)
361+
current_url = self.get_current_tab_url()
362362
link.click()
363-
time.sleep(1)
363+
Wait(self.driver, 10).until(EC.url_changes(current_url))
364364
opened_pages.append(self.get_current_tab_url())
365+
print(*opened_pages, sep='\n') # Temporarily for debugging
365366
return opened_pages
366367

367368
@allure.step("""Click on external links in the Header and thereby open corresponding web pages on new tabs

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def auto_test_user_authorized(driver, main_page_open):
154154
page.element_is_visible(LoginPageLocators.INPUT_LOGIN).send_keys(os.environ["LOGIN"])
155155
page.element_is_visible(LoginPageLocators.INPUT_PASSWORD).send_keys(os.environ["PASSWORD"])
156156
page.element_is_present_and_clickable(LoginPageLocators.SIGN_IN_BUTTON).click()
157+
print("Current URL:", driver.current_url) # Temporarily for debugging
157158
page.check_expected_link(MainPageLinks.URL_GROUPS_PAGE)
158159
print("Current URL:", driver.current_url) # Temporarily for debugging
159160
page = ProfilePage(driver)

0 commit comments

Comments
 (0)