简体   繁体   English

在python中使用selenium单击网页的xy?

[英]Click on xy of a webpage using selenium in python?

Automating logging into homeroom everyday, the teacher posts a new link to meets everyday but the link is always in the same position on the screen.每天自动登录班级,老师发布了一个新的链接到日常会议,但该链接始终在屏幕上的相同位置。 I cant simply find element by xpath, id, class etc... This is why I figured if I could simply click on certain coordinates my problem would be solved but im having trouble doing this in selenium.我不能简单地通过 xpath、id、class 等找到元素......这就是为什么我想如果我可以简单地点击某些坐标,我的问题就会解决,但我在 selenium 中这样做有困难。 Im fairly new to python though and im sure theres something ive missed, any bright ideas?我对 python 相当陌生,我确定我错过了一些东西,有什么好主意吗?

Can actually not comment your question directly, cause of reputation - Would be great to show some code you have written or going more in to detail.实际上不能直接评论您的问题,这是声誉的原因 - 展示您编写的一些代码或更详细地说明会很棒。

Just a hint ActionChains只是一个提示 ActionChains

from selenium.webdriver.common.action_chains import ActionChains
actions = ActionChains(driver)

actions.move_to_element_with_offset(driver.find_element_by_tag_name('body'), 0,0)
actions.move_by_offset(X coordinates, Y coordinates).click().perform()

Try PyAutoGUI .试试PyAutoGUI

You can pip install it, then add pyautogui.moveTo(x, y) in your Selenium script.您可以pip install它,然后在 Selenium 脚本中添加pyautogui.moveTo(x, y)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Python 中使用 Selenium 单击网页中的所有按钮 - Using Selenium in Python to click all buttons in a webpage 使用 Selenium 和 Python 访问网页时,Selenium 无法单击元素 - Selenium unable to click on elements while accessing a webpage using Selenium and Python 无法使用硒Python在Ajax网页中单击下拉选项 - Not able to click on drop down option in a ajax webpage using selenium python 如何使用Selenium和python单击网页上的所有“ role = button” - How to Click on all “role=button” on a webpage using selenium and python 如何使用 Selenium 和 Python 在网页上单击 Continue Checkout gif 元素? - How to click on Continue Checkout gif element on webpage using Selenium and Python? 如何使用Python中的Selenium在动态网页中点击Javascript链接? - How to click on Javascript link in dynamic webpage using Selenium in Python? 使用selenium API for python单击网页中的随机链接 - Click on random link in webpage using selenium API for python 如何使用硒和python单击网页上的元素 - How can i click the element on webpage using selenium with python 如何使用python硒单击网页中最后找到的文本 - How to click the last found text in webpage using python selenium 我无法使用Python / Selenium单击网页中的任何元素 - I can't click any element in a webpage using Python/Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM