I have to test the register functionality of my website. When a user creates an account on the website, it sends an email to his mailbox. A user clicks on confirmation URL and unlocks functionality of the website.

What is the best way to automate this functionality?

  • You know the URL in email, right? Cannot you simulate accessing a link with a known URL? What tools do you use? May 8, 2017 at 21:32
  • I don't know URL because server side generates it. I am a software developer and I don't have deep knowledge in testing. I am developing the pet project and want to add some automation for routine tests (like login, sign in, don't pass validation so on). I am going to use Selenium for this.
    – RredCat
    May 22, 2017 at 18:22
  • @PeterMasiar I am wondering how this is solving by professional QA
    – RredCat
    May 22, 2017 at 18:29

2 Answers 2


There are multiple ways to do it, just two immediately obvious:

One way is to deal with the email: check if it is present, read it, parse it, get URL, GET or POST it as appropriate.

Another way is to query the database for info related to confirmation emails, and build the URL from it.

As always, it all depends what tools/languages/libraries you have, what access you have, how much effort you want to invest in it.

  • It is good point about query database. What about reading/parsing email - does it has any services for this?
    – RredCat
    May 27, 2017 at 20:52
  • Most languages do have libraries to deal with email. What is your preferred language? May 30, 2017 at 13:57

Use this link to see how handling the email part works

Automation - Testing the Contents in EMail

Once that is done take the string of the content and get the link. You can do this with some regex matching pretty easily I think. Once you have the link create a new webdriver instance with a driver.get(thatemailurl). That should open a new browser when you can validate that the user was successfully able to register.

Now to make this repeatable you may want to write in some code to erase that specific user from the registration db at the end of the test so that specific email can continue to be used, that is up to you.

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.