Ask a Question

Questions about Browser Looping

Largent803
Contributor

Questions about Browser Looping

I am evaluating this product for possible use with for the company. I am attempting to create a test that will run on both

Chrome and Edge. 

I created the test using Chrome and when I originally ran the test on Chrome it works perfectly. Now I have added the looping function to it

but when I do that the system launches the Chrome browser then launches the Edge Browser and hangs there eventually it completes the test run

for Chrome but doesn't do the test run for Edge using the same steps. 

 

Is there a configuration to the Looping feature that is needed? So that it will run all the steps on both browsers.

20 REPLIES 20

Okay, now if you add Edge back in, what happens?

It Launches Chrome gets through two or three steps and then stops and Launches Edge and runs the full test. So it is not running all the steps in Chrome.

Please post a screenshot of the loop with Chrome and  then the loop with Chrome and Edge both included, and indicate where the second one stops working with Chrome.  

Browser Loop Chrome, Edge "https:", ... Iterates through the specified browsers.
BrowserWindow Click ... Clicks the 'BrowserWindow' object.
BrowserWindow Maximize Maximizes the specified Window object.
textboxUsername SetText "XXX" Sets the text 'XXXX' in the 'textboxUsername' text editor.
textboxUsername Keys "[Tab]" Enters '[Tab]' in the 'textboxUsername' object.
passwordboxPassword SetText Project.Variables.Password1 Sets the text Project.Variables.Password1 in the 'passwordboxPassword' text editor.
passwordboxPassword SetText Project.Variables.Password2 Sets the text Project.Variables.Password2 in the 'passwordboxPassword' text editor.

 

Error Log

Google Chrome was launched. 11:25:45 Normal 0.00
Navigating to the https://.. page. 11:25:50 Normal 5.62
The Chrome browser was not closed after the loop iteration was finished 11:26:00 Normal 10.08
Microsoft Edge was launched. 11:26:03 Normal 2.47
Navigating to the https:// page. 11:26:10 Normal 6.81
The Edge browser was not closed after the loop iteration was finished 11:26:20 Normal 10.14
The window was clicked with the left mouse button. 11:26:20 Normal 0.18
The 'CruiseHB-cruiseappdev - Work - Microsoft Edge' window was maximized. 11:26:20 Normal 0.12
The text 'XXXX' was entered in the text editor. 11:26:23 Normal 2.61
Keyboard input. 11:26:23 Normal 0.29
The value of the CL360_Test_Suite.CL360_Test_Suite.Password1 variable was entered in the text editor. 11:26:23 Normal 0.27
The value of the CL360_Test_Suite.CL360_Test_Suite.Password2 variable was entered in the text editor. 11:26:23 Normal 0.17
Keyboard input. 11:26:24 Normal 0.43
The window was clicked with the left mouse button. 11:26:27 Normal 2.99
The window was clicked with the left mouse button. 11:26:27 Normal 0.43
The window was clicked with the left mouse button. 11:26:28 Normal 0.50
The window was clicked with the left mouse button. 11:26:28 Normal 0.41
The text 'Bugs Bunn and Mickey' was entered in the text editor. 11:26:28 Normal 0.26
The window was clicked with the left mouse button. 11:26:29 Normal 0.39
The window was clicked with the left mouse button. 11:26:29 Normal 0.52
The window was clicked with the left mouse button. 11:26:30 Normal 0.46
The window was clicked with the left mouse button. 11:26:30 Normal 0.60
The window was clicked with the left mouse button. 11:26:31 Normal 0.40
Keyboard input. 11:26:32 Normal 0.97
The button was clicked with the left mouse button. 11:26:33 Normal 0.90
The window was clicked with the left mouse button. 11:26:33 Normal 0.54

 

Now these are what is happening with the error log.

Are you not able to take a screenshot?  It is helpful to see the code and the results in the context of the TestComplete UI.

function CL360_Login_Test()
{
//Launches the specified browser and opens the specified URL in it.
Browsers.Item(btChrome).Run("https://edge");
//Iterates through the specified browsers.
var BrowserItems, i;
BrowserItems = new Array(2);
BrowserItems[0] = Browsers.Item("edge");
BrowserItems[1] = Browsers.Item("chrome");
for(i = 0; i < BrowserItems.length; i++)
BrowserItems[i].Run("https://chrome");
OCR.Recognize(Aliases.browser.BrowserWindow).BlockByText("Cruise", spNearestToCenter).Click();
//Maximizes the specified Window object.
Aliases.browser.BrowserWindow.Maximize();
//Sets the text 'kfiander' in the 'textboxUsername' text editor.
Aliases.browser.pageCruiseheritage.textboxUsername.SetText("XXXX");
//Enters '[Tab]' in the 'textboxUsername' object.
Aliases.browser.pageCruiseheritage.textboxUsername.Keys("[Tab]");
//Sets the text Project.Variables.Password1 in the 'passwordboxPassword' text editor.
Aliases.browser.pageCruiseheritage.passwordboxPassword.SetText(Project.Variables.Password1);
//Sets the text Project.Variables.Password2 in the 'passwordboxPassword' text editor.
Aliases.browser.pageCruiseheritage.passwordboxPassword.SetText(Project.Variables.Password2);
//Enters '[Enter]' in the 'passwordboxPassword' object.
Aliases.browser.pageCruiseheritage.passwordboxPassword.Keys("[Enter]");
//Clicks the 'vg' control.
Aliases.browser.pageCruiseheritage.section.section2.vg.Click();
//Clicks the 'textnode' control.
Aliases.browser.pageCruiseheritage.section.section2.textnode.Click();
//Enters '[Down][Down][Down][Down][Down][Down][Down][Enter][Tab]' in the 'searchboxCenterDealdealsourcetyp' object.
Aliases.browser.pageCruiseheritage.section.section2.searchboxCenterDealdealsourcetyp.Keys("[Down][Down][Down][Down][Down][Down][Down][Enter][Tab]");
//Sets the text 'Daffy's ' in the 'textboxCenterDealdealname' text editor.
Aliases.browser.pageCruiseheritage.section.section2.textboxCenterDealdealname.SetText("Daffy's ");
//Sets the text 'Daffy's Adventuyre' in the 'textboxCenterDealdealname' text editor.
Aliases.browser.pageCruiseheritage.section.section2.textboxCenterDealdealname.SetText("Daffy's Adventuyre");
//Enters '[Tab]' in the 'textboxCenterDealdealname' object.
Aliases.browser.pageCruiseheritage.section.section2.textboxCenterDealdealname.Keys("[Tab]");
//Enters '[Down][Down][Down][Enter][Tab]' in the 'searchboxCenterDealbankerid' object.
Aliases.browser.pageCruiseheritage.section.section2.searchboxCenterDealbankerid.Keys("[Down][Down][Down][Enter][Tab]");
//Clicks the 'panel3' control.
Aliases.browser.pageCruiseheritage.section.section2.panel3.Click();
//Clicks the 'panel17' control.
Aliases.browser.pageCruiseheritage.panel17.Click();
//Enters '[Tab]' in the 'textboxCenterDealsubmissiondate' object.
Aliases.browser.pageCruiseheritage.section.section2.textboxCenterDealsubmissiondate.Keys("[Tab]");
//Clicks the 'textnode2' control.
Aliases.browser.pageCruiseheritage.section.section2.textnode2.Click();
//Clicks the 'panel18' control.
Aliases.browser.pageCruiseheritage.panel18.Click();
//Clicks the 'textnode3' control.
Aliases.browser.pageCruiseheritage.section.section2.textnode3.Click();
//Enters '[Down][Down][Down][Down][Down][Down][Down][Down][Enter]' in the 'searchboxCenterDealdepartmentDep' object.
Aliases.browser.pageCruiseheritage.section.section2.searchboxCenterDealdepartmentDep.Keys("[Down][Down][Down][Down][Down][Down][Down][Down][Enter]");
//Clicks the 'panel8' control.
Aliases.browser.pageCruiseheritage.section.section2.panel8.Click();
//Enters 'My Testing Scenario' in the 'panel8' object.
Aliases.browser.pageCruiseheritage.section.section2.panel8.Keys("My Testing Scenario");
//Clicks the 'buttonClear' button.
Aliases.browser.pageCruiseheritage.section.section2.buttonClear.ClickButton();
}

 

This is the function that I came up with. It works depending on the order I have selected so if I choose Edge first it will Launch Edge then hold it open. Then Launch Chrome and complete all the steps and vice versa.

The farthest it goes in either case is the Username and Password.

There's a problem with your syntax here

Marsha_R_0-1629239427448.png

 

You have Chrome and Edge in the same call.

The correct syntax would be like this:       Browsers.Item(btChrome).Run();

 

Take a look at this page.  It shows you the correct syntax for browser loops, with some different choices on how to name the browsers.

https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/web/general/browsers...

I edited out the code as you suggested however, I still received the same error where it would launch the Chrome Website and then go up to the Username and password piece and then stop at that portion. 

It would then launch the Edge part of the code and completely run the script.

Please post a screenshot of the edited code.

I figured out what was going on with the looping it had do with the fact that I didn't know I needed to make the code below the browser loop children of the loop. Once I did that the loop worked perfectly.

cancel
Showing results for 
Search instead for 
Did you mean: