Forum Discussion
Thanks for the updates
When developing the scripts what things we need to take care of ?
I need help how to get started with developing the script when running our tests in different browser in Environment manager
Thanks
Nishchal
Hi Nishchal,
I am second to everything mentioned by tristaanogre.
As for scripts development, nothing special (except the mentioned problem with Script Extensions) to take care of. It is expected that you will check locally how your test code works with different browsers before running it through the Environment Manager. Obviously, there is no possibility to debug test code on remote machines, so maybe you need to consider proper and descriptive logging.
Otherwise, essentially the Environment Manager is a tool to start required browser for the required OS in the remote environment, deploy your test code there and execute tests there.
- nisgupta8 years agoValued Contributor
Thank you for the updates. I am trying the below scripts . Set the Environment manager to run in browsers - Firefox, Chrome, IE, Microsoft Edge. Sometime the script pass in all browsers. Sometimes it fails in one of the browser. Not sure what need to be updated in the script. Please let me know
function crossBrowserTaxFormsStatus()
{
var url = "https://taxforms.app.texastech.edu/";
var page = Aliases.browser.pageTtusTaxForms
var logoutbtn = Aliases.browser.pageTtusTaxForms.panelTopNav.buttonLogout;
var titlePage = Aliases.browser.pageTtusTaxForms.panelTopNav.textnode1098tTaxForms;
var signInPageTitle = Aliases.browser.pageEraiderWebSignIn.textEraiderSignIn;for(var i = 0; i < Browsers.Count; i++){
browser = Browsers.Item(i);
Log.Message("Browser " + aqConvert.IntToStr(i) + " : " + browser.Description);
browser.Run(url);
LoginCredentials.basicAuthentication();
GeneralFuncs.CheckTitlePage(Aliases.browser.pageTtusTaxForms.panelTopNav.textnode1098tTaxForms);
LoginCredentials.LogOut(logoutbtn);
GeneralFuncs.CheckTitlePage(signInPageTitle);
Aliases.browser.Close();}
//CheckTitlePage
function CheckTitlePage(TitleObj)
{
if(TitleObj.WaitProperty("Exists", true, 5000))
{
Log.Message("The Title of the page is: " +" "+TitleObj.contentText);
}
else
{
Log.Error("Title is not correct/do not exists");
}
}//basicAuthentication
function basicAuthentication(){
var username = ProjectSuite.Variables.Username;
var password = ProjectSuite.Variables.Password;
var page = Sys.Browser().Page("*");
try{
page.Login.TextBox("UserName").SetText(username);
page.Login.Textbox("password").SetText(password);
delay(2000);
page.Login.Button("OK").Click();
page.Wait();
Sys.Browser().BrowserWindow(0).Maximize();
} catch(e){
Log.Error("InvalidPage/Login" +e);
}
}//LogOut
function LogOut(objLogOutPathName)
{
// Delay(5000);
var objLogOutPathNameExists = false;
try{
objLogOutPathNameExists = objLogOutPathName.Exists;
if(objLogOutPathNameExists == true)
{
Log.Message(objLogOutPathName.contentText);
objLogOutPathName.Click();
}
}catch(e){
Log.Error("Error" +e);
}
}- nisgupta8 years agoValued Contributor
Also the below code I am running locally in different browsers. The script run all the browsers one by one installed on the machine. Do we need to make any changes in the code ?
var BrowserConfig = require("BrowserConfig");
var GeneralFuncs = require("GeneralFuncs");
var LoginCredentials = require("LoginCredentials");function testCrossBrowser()
{
var url = "https://taxforms.app.texastech.edu/";
var logoutbtn = Aliases.browser.pageTtusTaxForms.panelTopNav.buttonLogout;
var titlePage = Aliases.browser.pageTtusTaxForms.panelTopNav.textnode1098tTaxForms;
var signInPageTitle = Aliases.browser.pageEraiderWebSignIn.textEraiderSignIn;
for(var i = 0; i < Browsers.Count; i++){
BrowserConfig.killProcess("iexplore");
BrowserConfig.killProcess("firefox");
BrowserConfig.killProcess("chrome");
browser = Browsers.Item(i);
Log.Message("Browser " + aqConvert.IntToStr(i) + " : " + browser.Description);
browser.Run(url);
LoginCredentials.basicAuthentication();
GeneralFuncs.CheckTitlePage(Aliases.browser.pageTtusTaxForms.panelTopNav.textnode1098tTaxForms);
aqUtils.Delay(5000);
LoginCredentials.LogOut(logoutbtn);
GeneralFuncs.CheckTitlePage(signInPageTitle);
aqUtils.Delay(2000);
Aliases.browser.Close();
}
BrowserConfig.killProcess("iexplore");
BrowserConfig.killProcess("firefox");
BrowserConfig.killProcess("chrome");
}//Kill the browser process
function killProcess(PName)
{
killProcess = 0;
var p = Sys.WaitProcess(PName, 5000, 1);
while(p.Exists){
killProcess = killProcess + 1;
p.Terminate();
while(p.Exists){
Sys.Delay(50);
}
p = Sys.WaitProcess(PName,5000,1);
}
Log.Message("Process terminated");
}- tristaanogre8 years agoEsteemed Contributor
The EnvironmentManager functionality determines the browser.... so, your browser loops would not apply. You would need to write your automation in such a way to use whatever browser opens in the designated test environment.