Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com

Sending email after executing script on SAHI

Hi Guys,

I know there has been a lot of discussions about sending an email after executing sahi script, need your help as i am stuck with a certain error:

Java constructor for "net.sf.sahi.ant.Mailer" with arguments "string,number,string,string,boolean" not found.

and

Java constructor for "net.sf.sahi.ant.Mailer" with arguments "string,number,string,string,boolean" not found. (RhinoScriptRunner.run#20)

==========================================
C:\Users\katbe\sahi\userdata\bin>testrunner kat_test.sah http://sahi.
co.in/demo/ firefox
test=scripts/kat_test.sah
browserType=firefox
baseURL=http://sahi.co.in/demo/
host=localhost
port=9999
threads=5
useSingleSession=false

suiteName = scripts/kat_test.sah
base = http://sahi.co.in/demo/
sahiHost = localhost
port = 9999
threads = 5
browserType = firefox
this.isSingleSession == false
Added shutdown hook.
http://localhost:9999/_s_/dyn/Suite_start?suite=scripts/kat_test.sah&base=http
%3A%2F%2Fsahi.co.in%2Fdemo%2F&threads=5&sahisid=sahi_d1deee7e0257e04c760a45004f3
92f4379fc&browserType=firefox&html=
FAILURE
Shutting down ...
=========================================

Here's what the script looks like
(kat_test.sah)
_navigateTo("http://sahipro.com/demo/training/login.htm";);
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("Login"));
_setValue(_textbox("q"), "1");
_setValue(_textbox("q[1]"), "2");
_setValue(_textbox("q[2]"), "3");
_click(_cell(15));
_click(_button("Add"));
_click(_button("Logout"));

sendEmail("Mail from Sahi", "All izz well");

function sendEmail($emailSubject, $emailBody) {
var $host = "smtp.gmail.com";
var $port = 465;
var $username = "test111@gmail.com";
var $password = "111";
var $isSSL = true;
var $mailer = new Packages.net.sf.sahi.ant.Mailer($host,$port,$username,$password,$isSSL);
var $from = "test111@gmail.com";
var $to = "test111@gmail.com";
$mailer.send($from, $to, $emailSubject, $emailBody);
}

function onScriptEnd(){
var $status = _scriptStatus();
var $scriptName = _scriptName();
var $scriptPath = _scriptPath();
sendEmail($status + ": " + $scriptName, "Script: " + $scriptPath + "\nStatus: " + $status);
}

===========
start_dashboard.bat

@ECHO ON
SET SAHI_HOME=..\..
SET SAHI_USERDATA_DIR=..
SET SAHI_EXT_CLASS_PATH=
SET SAHI_EXT_CLASS_PATH=%SAHI_USERDATA_DIR%\extlib\mail.jar;%SAHI_HOME%\lib\ant-sahi.jar;

CALL %SAHI_HOME%\bin\dashboard.bat



also, i tried removing var $isSSL = true and $isSSL on var $mailer as stated on the previous thread but when i try to run it, after executing the script, the browser window wont close and its stuck. Hoping for your assistance on this. Thanks a lot!!
Sign In or Register to comment.