We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df8a548 commit e00a86cCopy full SHA for e00a86c
notebook/tests/selenium/utils.py
@@ -324,9 +324,11 @@ def new_window(browser, selector=None):
324
"""
325
initial_window_handles = browser.window_handles
326
yield
327
- new_window_handle = next(window for window in browser.window_handles
328
- if window not in initial_window_handles)
329
- browser.switch_to.window(new_window_handle)
+ new_window_handles = [window for window in browser.window_handles
+ if window not in initial_window_handles]
+ if not new_window_handles:
330
+ raise Exception("No new windows opened during context")
331
+ browser.switch_to.window(new_window_handles[0])
332
if selector is not None:
333
wait_for_selector(browser, selector)
334
0 commit comments