Skip to content

Instantly share code, notes, and snippets.

@JasonCrowe
Created October 29, 2019 15:50
Show Gist options
  • Save JasonCrowe/148a02abc20b69a54b672b30110447b5 to your computer and use it in GitHub Desktop.
Save JasonCrowe/148a02abc20b69a54b672b30110447b5 to your computer and use it in GitHub Desktop.
Sample code to show how to create tabs and change between them.
window1 = driver.current_window_handle
driver.execute_script('''window.open("https://gmail.com","_blank");''')
window2 = [w for w in driver.window_handles if w != window1][0]
driver.switch_to.window(window2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment