18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Call a specific function

arunbalaarunbala Members
edited November -1 in Sahi - Open Source
Hi,

I just want to call a specific function from another script. I have used _include(). But its calling all the functions from that script.
Below is my script.

_include("C:\Documents and Settings\Arun.B\sahi_pro\userdata\scripts\InitiateTransaction.sah");
LoginAndValidation();
>>>> This function is from another script.
Delivery();
BankDetails();
//AttachFile();
NullAttachment();


function NullAttachment(){
_click(_imageSubmitButton("Submit"));
_assertExists(_span("ctl00_cphClientBody_uctlModalPopup_lblMessage"));
_click(_button("OK[1]"));
_click(_imageSubmitButton("Submit"));

}

function AttachFile(){
_click(_checkbox("ctl00\$cphClientBody\$chkAttachFile"));
_click(_imageSubmitButton("Submit"));
_assertExists(_span("ctl00_cphClientBody_uctlModalPopup_lblMessage"));
_click(_button("OK[1]"));
_setFile(_file("BrowseFile"), "C:/Documents and Settings/Arun.B/sahi_pro/userdata/New.txt");
// Change the "type" attribute of file field
if (_isIE()){
_call(_file("BrowseFile").outerHTML = _file("BrowseFile").outerHTML.replace(/type=file/, "type=text"));
}else{
_call(_file("BrowseFile").type = "text");
}
// Set the value into the textbox
_setValue(_textbox("BrowseFile"), "C:/Documents and Settings/Arun.B/sahi_pro/userdata/New.txt"); _assert(_radio("ctl00_cphClientBody_ucFileUpload_rblView_0").checked);
_Click(_imageSubmitButton("Save and stay"));

}
And so on...............

Pls Help.

Comments

Sign In or Register to comment.