Created
December 1, 2015 10:00
-
-
Save ab9-er/08c3ce7d2d5cdfa94bc7 to your computer and use it in GitHub Desktop.
A very simple window switcher using Selenium Webdriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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