模拟登陆qq邮箱
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://mail.qq.com")
driver.implicitly_wait(20)
#获取iframe框的xpath
f1 = driver.find_element(By.XPATH,'//*[@id="QQMailSdkTool_login_loginBox_qq"]/iframe')
#切换框架
driver.switch_to.frame(f1)
#切换框架
driver.switch_to.frame('ptlogin_iframe')
driver.find_element(By.ID,'u').send_keys('10001')
sleep(5)
driver.quit()
多个框架的切换