close the command in selenium python automatically 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()