close window python selenium code example
Example: how to close windows in selenium python without quitting the browser
for handle in driver.window_handles:
driver.switch_to.window(handle)
driver.close()
for handle in driver.window_handles:
driver.switch_to.window(handle)
driver.close()