0
votes

Cant submit Captcha textfield in python selenium

Hello everyone, I want to submit a textfield which is filled with the Code for Captcha, but I can't submit it.

This is the Error:

Exception has occurred: NoSuchElementException
Message: Unable to locate element: ./ancestor-or-self::form

enter image description here

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.

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: 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...

1

1 Answers

0
votes

From official Selenium documentation:

CAPTCHA, short for Completely Automated Public Turing test to tell Computers and Humans Apart, is explicitly designed to prevent automation, so do not try!

What you could do instead is

  • Disable CAPTCHAs in your test environment
  • Add a hook to allow tests to bypass the CAPTCHA