>>9
handles = driver.window_handles
for h in handles:
 driver.switch_to.window(h)
 if 条件:
  driver.close()