Verify Email Notification Using Selenium Web Driver C#....

1,897 views
Skip to first unread message

mawa316

unread,
Aug 23, 2016, 9:19:55 AM8/23/16
to Selenium Users
Hi all,

My next testing mission involves some email verification.  Part of our Web app involves setting an email address for successful operation notification.  Once the action is performed, if successful, an email is dispatched to the entered address.

I stumbled upon this during initial investigation and wonder if this is along the lines of what I'm looking for...


I would basically need to sift through emails to find something with a Subject of "Operation Successful".

The article mentions using gmail, which is fine as I can set up a testing account.  However, I'm wondering if there is a way to query our in-house, work email server to accomplish the same task.

Does anyone have experience with incorporating email verification into their testing.  Any pointers would be greatly appreciated!!

Thanks in Advance!!!

Shawn McCarthy

unread,
Aug 23, 2016, 11:59:20 AM8/23/16
to Selenium Users
I agree with that article. With that in mind, its good to know, it does NOT use selenium to verify emails. It uses the java mail APIs.

mawa316 .

unread,
Aug 24, 2016, 11:29:15 AM8/24/16
to seleniu...@googlegroups.com
So at this point I'm guessing the java executor would be used from Selenium.  I wonder how a return is received from a java mail checking script so that the test will fail if the appropriate notification was not received via email.

Does anyone actually have an example?

Anything MUCH appreciated!!

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/k36Vp_FFFNI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1ed06e10-fe83-4f09-b84c-6d7c9123e5a0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

⇜Krishnan Mahadevan⇝

unread,
Aug 24, 2016, 11:49:56 AM8/24/16
to Selenium Users
Just to ensure that we are clear on this :

Lets say I have a test class named SignUpValidationTest.java which has the following steps :

1. Load Sign-up URL
2. Fill up details
3. Click on Sign-up link
4. Retrieve OTP from email provided during sign up
5. Complete sign-up process
6. Retrieve "welcome mail" from the email account provided during sign-up and run validations on it.


Here step 1-3 and step (5) would be done using Selenium and for doing step (4) the SignUpValidationTest.java class would make use of JavaMailAPIs wherein it would invoke the APIs to retrieve the mail content and then resort to something as simple such as String parsing to retrieve the OTP code.

Step (6) would basically again involve the Java class resorting to JavaMail APIs to retrieve the mail content and then the test class basically runs assertions on the retrieved text.

Does that make sense ?


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Wed, Aug 24, 2016 at 8:58 PM, mawa316 . <maw...@gmail.com> wrote:
So at this point I'm guessing the java executor would be used from Selenium.  I wonder how a return is received from a java mail checking script so that the test will fail if the appropriate notification was not received via email.

Does anyone actually have an example?

Anything MUCH appreciated!!
On Tue, Aug 23, 2016 at 11:59 AM, Shawn McCarthy <shawn.m...@gmail.com> wrote:
I agree with that article. With that in mind, its good to know, it does NOT use selenium to verify emails. It uses the java mail APIs.


On Tuesday, August 23, 2016 at 6:19:55 AM UTC-7, mawa316 wrote:
Hi all,

My next testing mission involves some email verification.  Part of our Web app involves setting an email address for successful operation notification.  Once the action is performed, if successful, an email is dispatched to the entered address.

I stumbled upon this during initial investigation and wonder if this is along the lines of what I'm looking for...


I would basically need to sift through emails to find something with a Subject of "Operation Successful".

The article mentions using gmail, which is fine as I can set up a testing account.  However, I'm wondering if there is a way to query our in-house, work email server to accomplish the same task.

Does anyone have experience with incorporating email verification into their testing.  Any pointers would be greatly appreciated!!

Thanks in Advance!!!

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/k36Vp_FFFNI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.

mawa316 .

unread,
Aug 24, 2016, 4:35:15 PM8/24/16
to seleniu...@googlegroups.com
Yes that makes sense and goes along my line of thinking.

Our app does the following....

Login
Click a browse button, which opens a Windows File browse form/window.
Selected files from the window populate a grid
Click an upload button.
Verify grid reflects proper results and that files were actually uploaded.

The above is all accomplished or checked via my Selenium test.

Once the files are uploaded an email is dispatched, which is what I want/need to check with the JavaMail api.  So, I guess I have to surf for a good java class example that hooks up to the server and looks for a certain subject.

I will also search for how to call this class and retrieve a result return from Selenium WebDriver.

So first step, I add a new Class to my Selenium Project?

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/k36Vp_FFFNI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

praveen kumar cherukuri

unread,
Aug 24, 2016, 5:21:10 PM8/24/16
to seleniu...@googlegroups.com
Hello, 

I like your mission and its goal. 
Let me put my thoughts and share my experiences. Not necessarily fitting your requirement. 

Our mission (as understood from your question): 

Step 1: Do something (selenium) which triggers an email notification.
Step 2: Verify the email notification. 


My Approach: 

Step 1: As usual. 
For triggering the email, use a disposable email service. (example email : testingemail...@mailinator.com)
Mailinator is a free disposable email service. You can have free access to the mail API.

Step 2: Verifying the email inbox
Mails sent to the example email mentioned above can be checked/accessed from the URL below: 

You can access the mailbox using the rest call to the Mailinator API. Read more at https://www.mailinator.com/
I guess, this will be the simplest way to handle the mail notification verification scenarios. I found it useful and helpful. 

Hope this works for your requirement. Let us know your comments and opinion on using this service. 

Sharing is Caring.. 
Good Luck.. !!

Regards,
Praveen. 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

mawa316 .

unread,
Aug 25, 2016, 6:45:29 PM8/25/16
to seleniu...@googlegroups.com
It seems the API is only for paying customers.  Or, is the REST stuff the free stuff.

Is this something separate from the javaMail and if not, is it more advantageous because its easier to work with?

I'm not quite sure how this works.  Is it setting up a fake email server in code, direct the notifications from my app to that server, then check the server for the message.

That would be kind of cool.  It's in java so I'll have to learn that as I'm a newb with regard to that.

I believe someone mentioned adding a java class to handle the email stuff.  Do I just Add item to my Selenium project with type java class?

I'm actually excited to get an understanding of the interaction with java.

On Wed, Aug 24, 2016 at 5:20 PM, praveen kumar cherukuri <praveen....@gmail.com> wrote:
Hello, 

I like your mission and its goal. 
Let me put my thoughts and share my experiences. Not necessarily fitting your requirement. 

Our mission (as understood from your question): 

Step 1: Do something (selenium) which triggers an email notification.
Step 2: Verify the email notification. 


My Approach: 

Step 1: As usual. 
For triggering the email, use a disposable email service. (example email : testingemailnotification@mailinator.com)
Mailinator is a free disposable email service. You can have free access to the mail API.

Step 2: Verifying the email inbox
Mails sent to the example email mentioned above can be checked/accessed from the URL below: 

You can access the mailbox using the rest call to the Mailinator API. Read more at https://www.mailinator.com/
I guess, this will be the simplest way to handle the mail notification verification scenarios. I found it useful and helpful. 

Hope this works for your requirement. Let us know your comments and opinion on using this service. 

Sharing is Caring.. 
Good Luck.. !!

Regards,
Praveen. 

On Tue, Aug 23, 2016 at 6:49 PM, mawa316 <maw...@gmail.com> wrote:
Hi all,

My next testing mission involves some email verification.  Part of our Web app involves setting an email address for successful operation notification.  Once the action is performed, if successful, an email is dispatched to the entered address.

I stumbled upon this during initial investigation and wonder if this is along the lines of what I'm looking for...


I would basically need to sift through emails to find something with a Subject of "Operation Successful".

The article mentions using gmail, which is fine as I can set up a testing account.  However, I'm wondering if there is a way to query our in-house, work email server to accomplish the same task.

Does anyone have experience with incorporating email verification into their testing.  Any pointers would be greatly appreciated!!

Thanks in Advance!!!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/k36Vp_FFFNI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.

praveen kumar cherukuri

unread,
Aug 30, 2016, 3:59:14 AM8/30/16
to seleniu...@googlegroups.com
Sorry for the delay. 

Yeah, I can give you more details about this API. 

Mailinator is a service which gives free API to the disposable emails.
Its API is simple and implementation is on the basic email functionality.

Advantages of using this service: 
1. In Java, interacting with API is quite easy. 
- Instead of writing the Java-Mail (gmail/yahoo/...) mail interactions, it is easy and quick to interact with this Mailinator Rest API. 

2. No dependency on the existence of email id in the server
- Suppose in the traditional Java-Mail (gmail/yahoo/...) mail interactions, if we try to send/receive mail from/to an email id which is not existing, there will exceptions will be thrown. But in Mailinator, there is no such type of issue. You can send/receive emails from this API even if the email id does not exist. Mailinator will create the email id automatically and generates the API for the same. 

3. No authentication issues
4. API is quickly updated. 


Disadvantages/limitations of this mailinator service
*Very Important* to know before we start using this service
- we should be aware that this is a public server. and should be careful while dealing with sensitive and confidential data. 
- No harm at all when the details are related to a test environment. 

Let me know if you need anything in specific. 


/Praveen.



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

mawa316 .

unread,
Aug 30, 2016, 11:13:44 AM8/30/16
to seleniu...@googlegroups.com
I will keep this in mind.  What I've done is utilized the EWS Exchange API to query our in-house Exchange server.  It seems to be working OK for now, but if I run into problems I will look deeper into the method you explained.

Sorry for moving forward without posting so here.  I actually just wrapped up the testing on what I have done.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/k36Vp_FFFNI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages