python - Check if the active tab is the correct - Stack Overflow

PHOTO EMBED

Sun Sep 27 2020 17:12:19 GMT+0000 (Coordinated Universal Time)

Saved by @guido #python

desired_tab = driver.current_window_handle  #storing the handle in a variable
if driver.current_window_handle != desired_tab:
   driver.switch_to_window(desired_tab)  #switching to the tab in case it's not
content_copyCOPY

https://stackoverflow.com/questions/51924128/check-if-the-active-tab-is-the-correct