python - 如何使用 selininum 绕过文本验证码
问题描述
我试图绕过的网站是http://results.jntuh.ac.in/ 在 pi3 上使用 selenium 和 python 需要它用于拼贴项目,有什么方法可以绕过文本验证码,我可以从 catch 复制文本并粘贴到文本框中!
解决方案
.execute_script()
您可以将该方法与将为您执行此操作的 JavaScript 片段配对。这通过获取输入 CAPTCHA 的值,然后将其设置为输入字段的值来工作。
# Execute a script in the browser
browser.execute_script("""
// Set the value of the input to the value of the CAPTCHA text
document.querySelector("#txtInput").value = document.querySelector("#txtCaptcha").value
""")
推荐阅读
- ruby - 使用 ruby 过滤器在日志存储中将十六进制字符串转换为二进制和二进制到十进制
- reactjs - Connect.sid cookie,而不是前端设置的一组
- database - Laravel concat 查询返回 0 个项目
- utf-8 - MariaDB 中复制期间的奇怪转换
- flutter - 如何修复:上传包失败。扑
- java - 在@Modifying 注释中,Spring 持久数据总是在没有属性“flushAutomatically=true”的情况下被刷新
- javascript - 关于使用 Cloud KMS 进行签名验证的问题
- c# - ASP.Net Classic Serilog 不写入文件
- styled-components - 如何将 ts 文件中的对象添加到样式化组件全局主题中?
- uicollectionviewlayout - 使用带有集合节点的组合布局时如何使单元节点调整自身大小