coding:utf-8
引用webdriver
from selenium import webdriver
用来查找页面元素的类
from selenium.webdriver.common.by import By
模拟鼠标行为
from selenium.webdriver.common.action_chains import ActionChains
睡眠时间
import time
path = r’D:\webdriver\chromedriver.exe’
打开浏览器
wd = webdriver.Chrome(executable_path=path)
wd.get(‘http://192.168.1.251:9012/ui/test/ex18’)
time.sleep(3)
#切换到内嵌的网页之中
wd.switch_to.frame(wd.find_element(By.ID,‘iframe1’))
time.sleep(2)
wd.find_element(By.CSS_SELECTOR,’#test10’).click()
time.sleep(10)
wd.quit()