0

I have a written a program that will open windows in chrome, iterate through them to find a specific one and close that window if found.

I used a Mac OS python import and am having trouble converting this line:

for item in app('Web Chrome').window[0].tabs():

into a windows friendly version using webdriver. Any ideas?

db_gg
  • 129
  • 1
  • 11
  • Possible duplicate of [Switching into new window using Selenium after button click](https://stackoverflow.com/questions/47082900/switching-into-new-window-using-selenium-after-button-click) – undetected Selenium Jan 26 '18 at 11:55
  • [Switching into new window using Selenium after button click](https://stackoverflow.com/questions/47082900/switching-into-new-window-using-selenium-after-button-click) doesn't solve this question – db_gg Jan 27 '18 at 13:42

1 Answers1

1

Did you try with window_handle function?

for handle in driver.window_handles:
    driver.switch_to_window(handle)
j.barrio
  • 1,006
  • 1
  • 13
  • 37