I am using Selenium to test my Spring based web application. Can you suggest a solution to bypass google reCAPTCHA while testing the application.
I am running automation test in this environment. So manually checking the "I'm not a robot" of reCAPTCHA is not possible.
For testing purpose I am using test key on my testing environment given on below location.
Google reCAPTCHA Testing Key
I am using Angular 5 as front-end of my application. I am using ng-recaptcha library for adding reCAPTCHA in ui.
In case you are using reCAPTCHA v2, you can put the Site Key and Secret Key also known as the test keys. These keys help in bypassing the CAPTCHA verification request and as a result, your automation case can run seamlessly. Once you enable the site keys you will see a warning message as shown below.
The above mentioned ways are the only verified ways to handle CAPTCHA using Selenium Web Driver. Therefore, it is now very much clear that not everything can (or should) be automated, and CAPTCHA is one example where manual testing is still needed.
You can do this by finding the x and y coordinates of the checkbox in reCAPTCHA and click the element.
WebElement captcha = driver.findElement(By.xpath("html/body/div[1]/div[3]/div[2]/form/div[5]/div"));
builder.moveToElement(captcha, 50, 30).click().build().perform();
I don't know your exact code but you should be able to run your server with a System Property or some flag which indicate that the reCaptcha should be disable and to not add it to the form in the first place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With