首页 > 解决方案 > 如何使用 selininum 绕过文本验证码

问题描述

在此处输入图像描述

我试图绕过的网站是http://results.jntuh.ac.in/ 在 pi3 上使用 selenium 和 python 需要它用于拼贴项目,有什么方法可以绕过文本验证码,我可以从 catch 复制文本并粘贴到文本框中!

标签: pythoncaptcha

解决方案


.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

""")

推荐阅读