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/ex16’)
time.sleep(3)
ele = wd.find_element(By.LINK_TEXT, ‘示例’)
浏览器,将鼠标悬停在那个控件中
ActionChains(wd).move_to_element(ele).perform()
time.sleep(2)
wd.find_element(By.PARTIAL_LINK_TEXT, ‘示例1’).click()
time.sleep(10)
wd.quit()