You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Michael,
working on a project which deals with multiple tabs,
Examples:
1.opening a URL
2. click on a link switch to new tab and get the header(to assert the text with step #3)
3. back to parent tab click on a ink, switch to new tab and get the header
4.going back to parent tab and repeat.
my problem is want to close those two tabs before going to step 4
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.
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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.