无法提交验证码文本字段Python Selenium [英] Cant submit Captcha textfield Python Selenium
问题描述
无法使用python硒提交验证码文本字段
大家好,我想提交一个充满验证码代码的文本字段,但是我不能提交.
Hello everyone, I want to submit a textfield which is filled with the Code for Captcha, but I can't submit it.
这是错误:
Exception has occurred: NoSuchElementException
Message: Unable to locate element: ./ancestor-or-self::form
这是我的脚本(在其他网页上也可以正常使用):
This is my script(it works perfectly on other webpages):
sub = driver.find_element_by_class_name("g-recaptcha-response")
sub.submit()
还尝试了许多其他方法,但没有任何效果.
have tried also a lot of other things, but nothing worked.
以下是HTML代码:在此处输入图片描述Textfield是整个底部的文本.
Here the HTML-Code: enter image description here The Textfield is that in the whole bottom.
如果有人可以帮助我,我会很高兴.谢谢您的时间!
I would be very happy, if someone can help me. Thank you for you time!
Ps:这是我的第一个问题,对不起,如果我做错了什么.而且我不是来自美国或英国,所以我的英语有点不好...
Ps: This is my first Question, so sorry, if I did something wrong. And I am not from the USA or England, so my English is a bit bad...
推荐答案
来自官方Selenium 文档:
From official Selenium documentation:
CAPTCHA是完全自动化的公共Turing测试的缩写,它告诉计算机和人类分开,它是专门为防止自动化而设计的,因此请不要尝试!
CAPTCHA, short for Completely Automated Public Turing test to tell Computers and Humans Apart, is explicitly designed to prevent automation, so do not try!
相反,您可以做的是
- 在测试环境中禁用验证码
- 添加一个钩子,以允许测试绕过验证码
这篇关于无法提交验证码文本字段Python Selenium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!