python+selenium+chrome 做滑动验证码 会被浏览器检测到使用的自动软件导致滑动验证失败
2021/9/20 12:04:49
本文主要是介绍python+selenium+chrome 做滑动验证码 会被浏览器检测到使用的自动软件导致滑动验证失败,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
python+selenium+chrome 做滑动验证码 会被浏览器检测到使用的自动软件导致滑动验证失败
解决方法:代码中添加:
import time from selenium import webdriver from selenium.webdriver import ActionChains options = webdriver.ChromeOptions() options.add_argument('--disable-blink-features=AutomationControlled') #重点代码:去掉了webdriver痕迹 brow = webdriver.Chrome(chrome_options=options) brow.get(url) print("滑块") action_chains = ActionChains(brow) time.sleep(3) print("h1") slider1 = brow.find_element_by_xpath('//*[@id="nc_1_n1z"]') #定位滑块 action_chains.drag_and_drop_by_offset(slider1, 280, 0).perform() #开始滑块验证
根据情况通过options.add_argument()来添加ua和ip代理或其他的请求头信息
这篇关于python+selenium+chrome 做滑动验证码 会被浏览器检测到使用的自动软件导致滑动验证失败的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-18初探Python股票自动化交易:入门指南
- 2024-09-18Python量化入门:轻松掌握量化分析基础与实战
- 2024-09-18Python量化交易:入门指南与实践
- 2024-09-18Python量化交易:入门指南与实战技巧
- 2024-09-14Python人工智能项目实战:从零开始的实践指南
- 2024-09-14探索Python人工智能资料:初学者的指南
- 2024-09-14Python人工智能资料:初学者的全面指南
- 2024-09-13Matplotlib入门:轻松绘制Python数据可视化图表
- 2024-09-13Python人工智能:初学者的入门指南
- 2024-09-13Python人工智能:轻松入门与实践