I need to automate interaction with a website that is initially protected with ReCaptcha. Can I initially manually log in to the website and solve 2FA, then hand-over the existing manually initiated session to the testing application to automatically run through the website tests with my manually authenticated session?


2 Answers 2


I think it should be the other way around, letting the test hand it over to a manual users for a while:

  1. Start the Selenium test to open browser and goto CAPTCHA page
  2. Write a wait that waits for an element that would be shown after the CAPTCHA is completed. (Make sure this wait has a large timeout, maybe also enlarge the default timeouts. Be sure to reset default timeouts after your wait, if you change implicit wait your tests could wait for minutes when something is broken.)
  3. Fill in the CAPTCHA manually
  4. The test will see the element found and continue the test instantly, as it will poll for the element every 500ms by default.

Aslong the test is waiting for something you can just use the browser as normal.

Some reads:

  • Perfect, thanks Niels. I'll give this approach a shot. Commented Dec 3, 2017 at 17:42

Firstly, this is maybe be a smell that your application is not built with a testability mindset.

In the Automation environment:

1 - This feature should be removed;


2 - The user should be automatically log by sending a token generated uniquely by the application, identifying therefore the user.

There are ways of working around the issue, but this way you would still have an application difficult to test and probably your tests would take longer to run.

Attack the disease, not the symptoms.

  • Good point - but sometimes in dysfunctional situations the testing team can't perfectly dictate the testing environment, or a quick hacky approach is needed to test the 'internals' w/o disabling the initial security. Generally speaking though I think you are very right. Commented Dec 3, 2017 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.