Handling Multiple Window Tab #1068
-
Hi Michael, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @abdurraheemj, |
Beta Was this translation helpful? Give feedback.
-
Hi Michael, |
Beta Was this translation helpful? Give feedback.
-
Hi @abdurraheemj, |
Beta Was this translation helpful? Give feedback.
Hi @abdurraheemj,
https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_window_switching.py has a good example of opening new tabs and switching between them. If you need to close a tab, use
self.driver.close()
. Opening a new tab can be done withself.open_new_window()
, but you have to have at least one tab open to do that because it callsself.driver.execute_script("window.open('');")
to open the new tab, which requires an open tab to run that in the console.