python - 使用 .click() 或 .move_to_element() Selenium Python 模拟鼠标移动
问题描述
我正在做一个 Selenium 机器人项目,我注意到网站可以很容易地检测到机器人正在通过网站购买获取光标的 X 和 Y,因为 driver.click() 函数直接跳转到元素。有什么方法可以模拟鼠标移动以防止检测。
findtop = driver.find_element_by_class_name('topbutton').click()
time.sleep(3)
findbottom = driver.find_element_by_class_name('bottomButton').click()
这是我在控制台中得到的:
X:26 Y: 19
X:1006 Y: 707
我什至尝试过:
findtop = driver.find_element_by_class_name('topbutton').click()
time.sleep(3)
findbottom = driver.find_element_by_class_name('bottomButton')
webdriver.ActionChains(driver).move_to_element(findtop).perform()
findbottom = driver.find_element_by_class_name('bottomButton')
webdriver.ActionChains(driver).move_to_element(findbottom).perform()
结果相同。
解决方案
推荐阅读
- javascript - 在 html 表中填充天数
- flutter - Flutter:使用底部导航栏为应用栏颜色设置动画
- c - 在 C 中以编程方式打开和关闭 FreeBSD 中的蓝牙可见性
- c# - 选择 SQL Server DatetimeOffset 作为 .Net DateTimeOffset.Ticks
- rust - Is signed integer overflow in safe Rust in release mode considered as undefined behavior?
- php - 在不使用 XAMPP 等的 Windows 10 上更新 PHP 版本
- javascript - tensorflow js 模型(从 Keras 转换而来)有 3 个输出。我怎样才能提取它们?
- python - 如果 __name__ != __main__:
- angularjs - AngularJs——对 XMLHttpRequest 的访问已被 CORS 策略阻止
- r - 在 R 中运行大型 BigQuery 代码时出错