美文网首页Python专题我爱编程
Selenium----B站投稿悬浮定位

Selenium----B站投稿悬浮定位

作者: 右哼哼丨左哼哼 | 来源:发表于2018-02-22 13:48 被阅读16次
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
# 初始化
br = webdriver.Firefox()
# 打开指定网址
br.get('https://www.bilibili.com/')
# 定位"投稿"元素
Tougao = br.find_element_by_css_selector('.u-link')
# 鼠标悬浮事件
ActionChains(br).move_to_element(Tougao).perform()
# 休眠1秒,等待网页渲染完成,避免定位出错
time.sleep(1)
# 点击"投稿管理"
br.find_element_by_link_text('投稿管理').click()

都是基本操作,大家如若有兴趣,欢迎朋友,可以加交流群:692-858-412一起学习

相关文章

网友评论

    本文标题:Selenium----B站投稿悬浮定位

    本文链接:https://www.haomeiwen.com/subject/rtxztftx.html