0

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.

Any ideas on how to fix this problementer image description here?

4 Answers 4

1

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][1]:

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. [1]: https://www.selenium.dev/documentation/test_practices/discouraged/captchas/

2
  • Thanks Lee for the return. Yes we can't automated captcha using automation tools like selenium and the problem is i can't control the email service in this case yahoo and it can be gmail or another service Jan 20, 2023 at 21:43
  • @GhofraneChakroun Can you edit your post to say what your test case is? What's your purpose in trying to use Selenium and Email? Also consider, not every test can or should be automated. Your goal shouldn't be to test 3rd party services either.
    – Lee Jensen
    Jan 20, 2023 at 23:17
0

Not if you're using mail services you don't control.

You'll need to use something like Mailosaur or Mailtrap, or possibly set up your own mail server and accessing it through IMAP.

Is there a reason you need it to be Yahoo?

2
  • Thanks Roger for the answer. I think if i'm going to use other email services like gmail outlook ... it will be the same using mailosaur or mailtrap is a good idea but im looking for free tool. You speak about mail server is there any documontation can help ? And thank you Jan 20, 2023 at 21:39
  • There are guides all over the Internet. Hopefully you can keep it behind a firewall so that your test system and mail server can talk to each other and not the public Internet.
    – Roger Cook
    Jan 21, 2023 at 22:38
0

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 email & imaplib python library
    • 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
0
0

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

https://www.javatpoint.com/java-mail-api-tutorial

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.