Python+Selenium自动化测试之163框架切换

import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://email.163.com")
time.sleep(2)
iframe = driver.find_elements_by_tag_name("iframe")[0]
driver.switch_to.frame(iframe)
driver.find_element_by_name("email").send_keys("liujiale")
time.sleep(1)
driver.find_element_by_name("password").send_keys("666666")
time.sleep(1)
driver.find_element_by_id("dologin").click()
driver.switch_to.default_content()  # 退出框架

  

posted on 2020-09-08 16:48  Tester十点半  阅读(255)  评论(0编辑  收藏  举报

导航