IBM RFT – Descriptive Programming – Function to kill and start the application in browser.
This function can be used to launch the application URL in
browser. It contains “Mode” as a Flag variable which if used to decide whether
to close all the browser session and launches the specified URL in a new
browser, or launch the browser in without closing previously opened browser
sessions. As of now have hardcoded the value of Mode variable as “regression”
but can be dynamically retrieved from frameworks environment variable settings
file.
public boolean launch_browser_appURL (String appURL)
{
try{
String
mode = "regression"; // Modify Here to assign the value of mode from
Environment Variable.
if
(mode.equalsIgnoreCase("regression"))
{
try{
Runtime.getRuntime().exec("cmd
/c tskill iexplore");
logTestResult("All
Active Browsers closed....", true,””);
}
catch(Exception
e){
System.out.println("No
Active Browsers present to close");
logTestResult
("No Active Browsers present to close", true,"");
}
sleep(5);
}
if(appURL.equals("")){
logError("Application
URL is blank");
logTestResult
("Application URL is blank", false,””);
return
false;
}
//Start
the application in browser with the obtained URL
startBrowser(appURL);
sleep(sleep_min);
//Returns
true on success
return
true;
}
catch
(Exception e) {
logError("Unable
to launch: " + appURL);
logTestResult
("Unable to launch: " + appURL, false,””);
return
false;
}
}
Please feel free to reach me in case of queries and
suggestions.
No comments:
Post a Comment