Skip to content

Instantly share code, notes, and snippets.

Created Dec 1, 2015
What would you like to do?
A very simple window switcher using Selenium Webdriver
def change_window(browser):
Simple window switcher without the need of playing with ids.
@param browser: Current browser instance
curr = browser.current_window_handle
all_handles = browser.window_handles
for handle in list(set([curr]) - set(all_handles)):
return browser.switch_to_window(handle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment