Skip to content

Commit 78cdb3c

Browse files
committed
test: fix windows login tab
1 parent 803d8c1 commit 78cdb3c

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

sample/Tests/test/test_windows_helpers.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,32 @@ def login():
5757
# Get all window handles
5858
all_windows = driver.window_handles
5959

60-
print("Find the new window")
61-
new_window = [window for window in all_windows if window != driver.current_window_handle][0]
62-
63-
print("Switch to the new window")
64-
driver.switch_to.window(new_window)
60+
print("Find the window with email input...")
61+
new_windows = [window for window in all_windows if window != original_window]
62+
63+
print(f"Found {len(new_windows)} new windows to check: {new_windows}")
64+
65+
# Find the window with email input
66+
target_window = None
67+
for window in new_windows:
68+
try:
69+
print(f"Checking window: {window}")
70+
driver.switch_to.window(window)
71+
driver.find_element(By.ID, ':r1:')
72+
target_window = window
73+
print(f"Found email input in window: {window}")
74+
break
75+
except:
76+
print(f"Email input not found in window: {window}, trying next...")
77+
continue
78+
79+
if not target_window:
80+
print("Could not find email input field in any window!")
81+
driver.quit()
82+
return
83+
84+
print("Switch to the target window")
85+
driver.switch_to.window(target_window)
6586

6687
wait = WebDriverWait(driver, 60)
6788

0 commit comments

Comments
 (0)