Tuesday, January 18, 2011

Selenium - Send Email Notifications

Selenium Send Email Notifications

I have already written program to send email notification in my QTP Hybrid Framework using CDO object. Now I have got requirement to send email notifications after executing Selenium scripts. I have decided to reuse my existing code.

How to initiate .vbs file from Java
package Email;
public class ByCDO {
   public static void main(String argv[]) {
      try {
        Process p = Runtime.getRuntime().exec("cscript c:\\SendEmail.vbs ");
        p.waitFor();
        System.out.println(p.exitValue());
      }
      catch (Exception err) {
        err.printStackTrace();
      }
    }
}

Link for sending email using Java (Select this link)

If you are running your Selenium scripts using Hudson there is a provision to configure your mail. Attaching screen shot.



In Progress...
---

No comments:

Post a Comment