18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Shall we record the new script when technology changes?
Pratik Anand Shah
Moderators
This is the question we keep getting in our support calls. How to design your scripts/suite if you change the technology? How to create the framework which should work for such changes? Be it changing it from Salesforce to Lightning or Angular to Angular 2.
Here is the answer to all such questions.
There are following types of changes that can happen over the application.
We will take an example of Salesforce and Lightning to explain the framework. This deals with both the changes that can happen.
- We recorded scripts on a classic version with Accessor Repository Enabled and created a scenario file. (salesForcePoC.s.csv, classic_AR.sah)

The scenario file will remain the same as in both the application we need to first login and create the campaign. You will not need to modify the scenario file.
- Refactored the recorded script into functions. (functionsLib.sah). This is the common function file where we are keeping the functions for Salesforce.
- Once the flow was recorded correctly, we tried to playback the same script on a lightning version.
- There is slight change in the flow and some of the UI elements, so created new functions for different flows (change in flow to reach to create a campaign in lightning version) and kept in (lightning_Lib.sah).
lightning_lib.sah
lightning_AR.sah
classic_AR.sah
This is how it looks when we execute the same script on both the versions.

Create Campaign flow change

The conclusion:
- Record the script
- Create functions
- Call those functions in Scenario files
- Keep all the UI elements in the Accessor Repository Files.
So in future if there is any change in the flow, you just need to update the function file, if UI element has changed, you just need to update the Accessor Repository file.
You can read more about the best practices at
http://sahipro.com/docs/using-sahi/best-practices.html
Let me know your comments.
Thanks,
Pratik Shah
Here is the answer to all such questions.
There are following types of changes that can happen over the application.
- 1. Application UI has changed
- 2. Application flow has changed.
We will take an example of Salesforce and Lightning to explain the framework. This deals with both the changes that can happen.
- We recorded scripts on a classic version with Accessor Repository Enabled and created a scenario file. (salesForcePoC.s.csv, classic_AR.sah)

The scenario file will remain the same as in both the application we need to first login and create the campaign. You will not need to modify the scenario file.
- Refactored the recorded script into functions. (functionsLib.sah). This is the common function file where we are keeping the functions for Salesforce.
_include("classic_AR.sah");
function login($username, $pw){
_setValue($_EMAILBOX_USERNAME, $username);
_maskLogs("Masking the password");
_setValue($_PASSWORD_PW, $pw);
_unmaskLogs("Password masking ends");
_click($_SUBMIT_LOGIN);
}
function navigateCampaignMenu(){
// Navigate to the campaign menu in Classic Version
_wait(60000, _isVisible(_link("/Campaigns/")));
_click($_LINK_CAMPAIGNS);
_click($_SPAN_CREATE_NEW);
_click($_LINK_CAMPAIGN);
}
function createCampaign($campaignname, $startdate,$endDate, $expectedrevenue, $budgetedcost, $actualcost, $description){
_wait(60000, _isVisible(_image(0)));
_set($isLightning , document.domain.indexOf("lightning") >-1 );
if($isLightning){
// There is slight change in the navigation for lightning version if the script is executed on lightning version, we are loading
the files for lightning.
_log("Lightning version detected, loading files for lightning.","CUSTOM2");
_include("lightning_AR.sah");
_include("lightning_Lib.sah");
}
// If the script is executed on lightning version, navigateCampaingMenu() will be called of lightning_lib.sah
navigateCampaignMenu();
_focusWindow();
_takePageScreenShot();
_setValue($_TEXTBOX_CAMPAIGNNAME, $campaignname);
_setValue($_TEXTBOX_STARTDATE, $startdate);
_setValue($_TEXTBOX_ENDDATE, $endDate);
_setValue($_TEXTBOX_EXPECTEDREVENUE, $expectedrevenue);
_setValue($_TEXTBOX_BUDGETEDCOST, $budgetedcost);
_setValue($_TEXTBOX_ACTUALCOST, $actualcost);
_setValue($_TEXTAREA_TEXTAREA, $description);
_setStrictVisibilityCheck(true);
_click($_SAVE_BUTTON);
_setStrictVisibilityCheck(false);
}
- Once the flow was recorded correctly, we tried to playback the same script on a lightning version.
- There is slight change in the flow and some of the UI elements, so created new functions for different flows (change in flow to reach to create a campaign in lightning version) and kept in (lightning_Lib.sah).
lightning_lib.sah
function navigateCampaignMenu(){
// To handle the change in the flow. For classic, you need only 3 steps, for lightning steps and UI element has changed.
_click( $_DIV_SLDS );
_click($_DIV_SALES);
_wait(60000,_isVisible($_SPAN_CAMPAIGNS));
_click( $_SPAN_CAMPAIGNS);
_click($_DIV_NEW);
}
- Along with the flow, there were some changes in the element identifier. So added the new element identifiers (lightning_AR.sah)lightning_AR.sah
var $_SPAN_CAMPAIGNS = _span("Campaigns");
var $_LINK_CAMPAIGNSMENU = _link("Campaigns Menu");
var $_DIV_NEW = _div("New");
var $_TEXTAREA_TEXTAREA = _textarea(" textarea");
var $_SAVE_BUTTON = _span("Save");
var $_DIV_SALES = _div("Sales");
var $_DIV_SLDS = _div("slds-r4");
classic_AR.sah
var $_EMAILBOX_USERNAME = _emailbox("username");
var $_PASSWORD_PW = _password("pw");
var $_SUBMIT_LOGIN = _submit("Log In");
var $_TEXTBOX_CAMPAIGNNAME = _textbox("/Campaign Name/");
var $_TEXTBOX_STARTDATE = _textbox("Start Date");
var $_TEXTBOX_ENDDATE = _textbox("End Date");
var $_TEXTBOX_EXPECTEDREVENUE = _textbox("/Expected Revenue/");
var $_TEXTBOX_BUDGETEDCOST = _textbox("/Budgeted Cost/");
var $_TEXTBOX_ACTUALCOST = _textbox("/Actual Cost/");
var $_LABEL_DESCRIPTION = _label("Description");
var $_TEXTAREA_TEXTAREA = _textarea(0, _near($_LABEL_DESCRIPTION));
var $_SAVE_BUTTON = _submit("/Save/");
var $_LINK_LEADS = _link("Leads");
var $_BUTTON_NEW = _button(" New ");
var $_SELECT_NAME_SALUTATIONLEA2 = _select("name_salutationlea2");
var $_TEXTBOX_NAME_FIRSTLEA2 = _textbox("name_firstlea2");
var $_TEXTBOX_NAME_LASTLEA2 = _textbox("name_lastlea2");
var $_TEXTBOX_LEA3 = _textbox("lea3");
var $_TEXTBOX_LEA4 = _textbox("lea4");
var $_IMAGE_CAMPAIGNLOOKUP_NEWWINDOW = _image("Campaign Lookup (New Window)");
var $_LINK_TYTO = _link("Tyto");
var $_TEXTBOX_LEA20 = _textbox("lea20");
var $_SPAN_PRATIKSHAH = _span("Pratik Shah");
var $_LINK_LOGOUT = _link("Logout");
var $_LINK_CAMPAIGNS = _link("Campaigns");
var $_SPAN_CREATE_NEW = _span("Create New...");
var $_LINK_CAMPAIGN = _link("Campaign");
This is how it looks when we execute the same script on both the versions.

Create Campaign flow change

The conclusion:
- Record the script
- Create functions
- Call those functions in Scenario files
- Keep all the UI elements in the Accessor Repository Files.
So in future if there is any change in the flow, you just need to update the function file, if UI element has changed, you just need to update the Accessor Repository file.
You can read more about the best practices at
http://sahipro.com/docs/using-sahi/best-practices.html
Let me know your comments.
Thanks,
Pratik Shah