In my application I need to send a confirmation after which an mail will arrive to my Outlook which I need to open and click on the link which is sent in the mail.

Can someone please let me know if this is possible in Selenium and Java, or is there any workaround?

  • Selenium is a tool that automates web browsers. The answer is no. Use a server's API to get the emails. One option is mailosaur.com.
    – pavelsaman
    Jul 29 at 11:36
  • thanks for the input
    – user50414
    Jul 29 at 11:38

I need to open and click on the link which is sent in the mail.

You can go to Outlook.com and grab the last email using Selenium. You would do this if there isn't something like MailTrap in place. I did this for Gmail when testing a WordPress site. The only catch is that the email sites will update without your knowledge, potentially breaking the scripts you wrote.


In your automation script, you can use Sikulix to automate your desktop related actions



According to software testing solutions, using Selenium + Java, if you want to automate outlook, then you will be able to do that in web version only and not on the desktop app. To automate Outlook desktop app, you will need RPA(Robotic Process Automation) which is one of the simplest tools used to automate desktop apps.

Process to click on the link in the Outlook WebApp e-mail using Selenium + Java:

  1. Search for the desired mail using the subject of the mail set as the locator and click on the same.
  2. Search for the desired link on the mail body using any locator(tagName(a)) and click on the same.
  3. Verify that the link has been opened by checking the URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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