Skip to content

Handling Multiple Window Tab #1068

Answered by mdmintz
abdurraheemj asked this question in Q&A
Discussion options

You must be logged in to vote

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 with self.open_new_window(), but you have to have at least one tab open to do that because it calls self.driver.execute_script("window.open('');") to open the new tab, which requires an open tab to run that in the console.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants