cancel
Showing results for 
Search instead for 
Did you mean: 

How to create code Jscript using Testcomplete for 3 different users should login and see the authorization page

Highlighted
Contributor

How to create code Jscript using Testcomplete for 3 different users should login and see the authorization page

Hi,

I want to write code to check 3 different users to login and verify their authorized page and come back to the login using Jscript. Anybody please help me.



Regads,

Pradeep
2 REPLIES 2
Highlighted
Contributor

RE: How to create code Jscript using Testcomplete for 3 different users should login and see the authorization page

I had the same problem as you. If it's the best way, I do not know, but I created a file called "user.pwd" and put it in a folder on the local computer. After that, I created a function that reads the file containing the password and used it during the execution of scripts. In this way, each developer could have a file with the password on your machine that script always searches in a local directory.
Highlighted
Regular Contributor

RE: How to create code Jscript using Testcomplete for 3 different users should login and see the authorization page

You can use something similar to this, and adjust it to your own needs



function Start_Browser(site)

{

var espera;

var AW;

var app;

 

// configuracao projecto

Options.Run.Delay=1000;

Options.Run.Timeout=30000;

 

espera = 500;

    

aqUtils.Delay(espera, "Starting browser...");

 

if(aqString.Compare(Project.Variables.browser,"chrome",false)==0)

{  

mataChrome();

//AW = Browsers.Item("chrome").Run();

AW = Sys.Browser("chrome");

AW.Page("*").Wait(-1);

}

else

if(aqString.Compare(Project.Variables.browser,"firefox",false)==0)

{  

mataFirefox();

AW = Sys.Browser("firefox");

AW.Page("*").Wait(-1);

}

else

if(aqString.Compare(Project.Variables.browser,"iexplore",false)==0)

{  

mataIE();

AW = Sys.Browser(Project.Variables.browser);

AW.Page("*").Wait(-1);

}

 

AW.Page("*").ToUrl("http://www.google.com/");

Delay(1000);

Log.Picture(Sys.Desktop.Picture(), "[+] SCREENSHOT");

Delay(1500);

Delay(1000,"Waiting for page");

}





function login(profissional, password, site)

{

Start_Browser(site);



//Project.Variables.browser = "iexplore";



var path_formulario = Sys.Browser(Project.Variables.browser).Page("*").Panel("content").Panel("auth_keyb").Form("keybform");

var path_username = path_formulario.Panel(0).Textbox("j_username");

var path_password = path_formulario.Panel(1).PasswordBox("j_password");

var path_botao = path_formulario.Panel(2).ImageButton(0);  



path_username.WaitProperty("VisibleOnScreen", true, 3000);

path_username.SetText(profissional);



path_password.WaitProperty("VisibleOnScreen", true, 3000);

path_password.SetText(password);



path_botao.WaitProperty("VisibleOnScreen", true, 3000);

path_botao.DblClick();



Delay(4000);



} // login
LinkedIn 😄 "A SQL query walks into a bar and sees two tables. Walks up to them and says 'Can I join you?'"
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors