# 1、窗口切换
driver.switch_to.window()
# 2、iframe切换
# 方式一:通过iframe标签的name属性
driver.switch_to.frame("login_frame")
# 方式二:先定位iframe的标签,再进行切换
loc_ifr = (By.ID, "login_frame")
iframe_ele = driver.find_element(*loc_ifr)
driver.switch_to.frame(iframe_ele)
# 3、alert切换
标签:ifr,python,frame,driver,switch,切换,iframe,三大
From: https://www.cnblogs.com/nikeairball/p/17379141.html