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.
How can i open a IE or an Firefox browser in script level
Once the SAHI server is started, i want to open a browser by running the script.and i want record from the starting from entering URL.
_setValue(_textbox("txtUsername"), "");
_setValue(_password("txtPassword"), "");
For the above code its from the login page , i want to run it from the URL ...
_setValue(_textbox("txtUsername"), "");
_setValue(_password("txtPassword"), "");
For the above code its from the login page , i want to run it from the URL ...
Comments
_setValue(_password("txtPassword"), "password");
_click(_submit("Login"));
Kindly follow this video:
http://sahi.co.in/w/sample-videos
Regards
Sumitra
I want the same as like in QTP (SystemUtil.Run "iexplore.exe","Url")
how to call or invoke a browser after starting the server,without using that SAHI dashboard
_setValue(_textbox("txtUsername"),$User);
_setValue(_password("txtPassword"), $Pass);
_click(_submit("Login"));
_click(_imageSubmitButton("imgbtn"));
_click(_link("Sign Out"));
_click(_imageSubmitButton("btnClosse"));
_navigateTo("Url or login page");
}
var $values = ["user1|pass1", "user2|pass2","user3|pass3"]
for (var $i=0; $i<$values.length; $i++) {
LoginUsers($values[$i].split('|')[0],$values[$i].split('|')[1]);
}
I am using above code but am not able to open the new IE or the login page ,hw it can be done
Suppose "Driver.sah" is your sahi script and you wanna run it from IE browser at some moment of time during script execution.
Driver.bat
/////***content of bat file ***/
cd C://sahi/userdata/bin
testrunner.bat Driver.sah http://www.google.com ie
/////***content Ends ***/
And from script you can call above file using following command.
_execute('C:\\sahi\\userdata\\scripts\\Driver.bat');
Hope this might help to sort out your issue.
Please go through the steps i have done and the problem i'm facing and let me know.
Start SAHI
Launch IE through the SAHI dashboard
Record the actions done in the Log in page
closed the IE
Playback the Log in action using the above saved script
It works fine
But when i wanted to test for multiple users then I'm not able to open the IE without launching from the SAHI dashboard.
I have written a Login Function(as in my previous post) to execute for multiple users but the IE gets closed after the Sign-out functionality was executed for the User1. So i need to Open the IE automatically for same script to test for the User2,user3
I have not seen your last post while replying.....so i have replied accordingly.
I have changed your function little bit as follow...
function LoginUsers($User,$Pass){
_navigateTo("Url or login page");
_setValue(_textbox("txtUsername"),$User);
_setValue(_password("txtPassword"), $Pass);
_click(_submit("Login"));
_click(_imageSubmitButton("imgbtn"));
_click(_link("Sign Out"));
/****Exclude This line ****/
// _click(_imageSubmitButton("btnClosse"));
}
var $values = ["user1|pass1", "user2|pass2","user3|pass3",.......,"userN|passN"]
for (var $i=0; $i<$values.length; $i++) {
LoginUsers($values[$i].split('|')[0],$values[$i].split('|')[1]);
}
Dont close the window after testing with one data.i have kept that one line in comment and now you can use this code for testing same login page with N number of user and password.
Hope there is no specific requirement of closing that page after checking with one Username and Password.
_navigateTo("Login url");
_setValue(_textbox("txtUsername"),"username");
_setValue(_password("txtPassword"), "pwd");
_click(_submit("Login"));
_click(_imageSubmitButton("imgbtn"));
_click(_link("Sign Out"));
_navigateTo("login url");
_setValue(_textbox("txtUsername"),"username 2");
--Stopped Playback: FAILURE--
Here my scenario is :
Sign out page having only the close button , because my application is not as usual applications , when we click sign out it will take the user to login page.
My application sign out functionality is like it will close the browser too, if we click signout option.
Cause i feel that if it is web application you can navigate to other URL . So if direct navigating to Login page of application creating problem you can try navigating to other web site.
For example.
After signout action navigate to google.com...and than again navigate to ur application.
Its not exact solution but workaround.
And yes there is functionality like opening browser run time if you are using JAVA driver of SAHI for scripting.
But i dont know how much that will feasible to you to switch to that.
public void setUp(){
...
String browserPath = "/usr/bin/firefox";
String browserProcessName = "firefox";
String browserOption = "-profile /mnt/sda4/Sahi/sahi0321/sahi/userdata/browser/ff/profiles/sahi0 -no-remote";
browser = new Browser(browserPath, browserProcessName, browserOption);
browser.open();
}
public void testGoogle() throws ExecutionException{
browser.navigateTo("http://www.google.com/"
browser.textbox("q").setValue("sahi forums");
assertTrue(browser.submit("Google Search").exists());
browser.submit("Google Search").click();
browser.waitFor(1000);
browser.link("Sahi - Web Automation and Test Tool").click();
browser.link("Login").click();
System.out.println("check: browser.textbox(\"req_username\").exists() = " + browser.textbox("req_username").exists());
}