I'm trying to automate tests using Selenium and a Yahoo email address. The problem is when I run my test in Azure DevOps I face the CAPTCHA privacy terms.
You will not be able to bypass the CAPTCHA using Selenium. This would violate the purpose of using the CAPTCHA in the first place, which is to stop automation software/bots from bypassing it.
As stated in the 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! 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
So, what options do you have? As it recommends, if you have control of the application you're testing, you can turn off/disable the CAPTCHA in your dev, test, and staging environments. The purpose of testing your feature is not to test a 3rd party CAPTCHA system. You can disable this using a feature flag.
You can also add a hook. This can look like adding a query string to the URL to disable a feature.
Since we don't know your application or what your test case is, it's difficult to provide further advice. : https://www.selenium.dev/documentation/test_practices/discouraged/captchas/
My view points to handle captcha :
This is one of the limitation of automation to automate or handle captcha There is not straight way to handle captcha or discard, by pass like popups, alerts
As it is mandatory step, even if you just avoid captcha somehow with hackish way, still you can not progress to test actual flow and scenario On top of this for testing purpose there are few possible work around [Not recommended] as follows :
- By disabling Captchas in test environments
- By clicking the reCAPTCHA checkbox in Selenium
- By adding a delay in your selenium script and manually solving Captcha while running
Note - If you are interested for more details for those work around. Please refer this.
Email automation, confirmation:
- Honestly there could be multiple solutions Solution working for me is:
- I simply use emails with my official domain for automation
- Hence, no blocking email & hurdle got eliminated
- Email client for email verification or confirmation:
- I make a use of
- It will provide multiple methods for you to interact with your inbox and emails inside using exposed APIs
- Nice, clean and secure way to get raid of email interaction to extent automation reach
- I make a use of
Thanks for all as a result i found the solution is to use javax.mail to get the content of the email using password application and smtp protocol. This link can help