python3 打开页面后多窗口处理三种方法

多窗口处理三种方法
导包,实例化浏览器
from selenium import webdriver

fx=webdriver.Firefox()
方法一
fx.switch_to.window(fx.window_handles[1])
方法二
for handle in fx.window_handles:
   fx.switch_to.window(handle)
方法三
定位初始窗口句柄
current_handle=fx.current_window_handle
所有窗口句柄
all_hndles=fx.window_handles
for i in all_handles:
  if i !=current_handle:
    fx.switch_to.window(i)

逆风的方向更适合飞翔,不怕千万人阻挡,只怕自己投降!
原文地址:https://www.cnblogs.com/jackzz/p/9125709.html