I am presently working on a story that requires me to make payment via a credit card and Klarna, but unfortunately, I am not getting the right element when I try to locate it. However, I see the page has reCaptcha protection.
-
I attempted to answer the captcha piece of your question, however, unless we know what your code looks like, what the element locater looks like, the website DOM you are testing, we won't be able to give more advice on why the element you are using is not working. Please update with your test code and what the code of the DOM from the website you are testing.– Lee JensenCommented Oct 25, 2022 at 16:56
-
sqa.stackexchange.com/questions/17022/… Perhaps this can help you with the recaptcha issue.– IAmMilinPatelCommented Mar 25, 2023 at 2:08
1 Answer
Unfortunately, you will not be able to use Selenium to "get around" reCaptcha. As it states in the 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! There are two primary strategies to get around CAPTCHA checks:
Disable CAPTCHAs in your test environment Add a hook to allow tests to bypass the CAPTCHA
If you are testing payment methods in your test environment, get your team to disable reCaptcha, if it's something in your team's control. If this is a 3rd party integration, they might have a way to disable this. If you're doing this in a production environment, there's nothing you can do.