Selenium----百度首页设置悬浮定位
2018-02-22 本文已影响177人
右哼哼丨左哼哼
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
# 初始化
br = webdriver.Chrome()
# 打开指定网址
br.get("https://www.baidu.com")
# 定位设置元素
frist = br.find_element_by_link_text("设置")
# 鼠标悬浮事件
ActionChains(br).move_to_element(frist).perform()
# 定位搜索设置
menu = br.find_element_by_link_text("搜索设置")
# 点击事件
menu.click()
都是基本操作,大家如若有兴趣,欢迎朋友,可以加交流群:692-858-412一起学习