cancel
Showing results for 
Search instead for 
Did you mean: 

Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page('*')

SOLVED
bhcommunity1
Occasional Contributor

Re: Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page(

Ok, thanks for the help.  It uses just ObjectType.

bhcommunity1_0-1616010563804.png

 

Its weird.  A browser window always appears, but sometimes fails to load the provided URL page.

- I see the issue come and go when using firefox.  The fact that it works for the most part, tells me its not a firefox browser config issue.  

- I've never seen the issue when working with Edge or Chrome.  So I assume the network and webserver is getting/responding to the request ok.

 

It shouldn't happen in the first place - But after launching, maybe I should create a dynamic wait to check for the login page and while it fails to exist ask the browser to navigate to the url again.

 

thanks for the assistance.

AlexKaras
Community Hero

Re: Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page(

Hi,

 

Thank you for the screenshot.

This is what I expected to see and my current explanation is like this:

 

Prerequisite statements:

-- NameMapping for Browser will match any object with ObjectType property equal to Browser;

-- NameMapping for Page will match any Browser's child object with ObjectType of 'Page' and URL property equal to tested url;

-- If some child object cannot be found for the parent one this does not cause TestComplete to trace-back and search for another parent object;

-- Expression 'Aliases.Browser.Page' using human language effectively means this: "Search for any Browser object. Then, for the found object search for the child object that matches criteria specified for Page object."

 

Considering the above, I think that this is what happens:

From time to time browser process that has no visible window remains in the system. For example, this can be some browser running in the background. Or even regular browser with some other but tested page been opened.

When Aliases.Browser.Page.Wait() expression is executed, TestComplete finds this browser process (Browser_A), sticks to it and starts to wait for its child Page object. As the tested page is opened in another browser process (Browser_B started via the Browsers.Item(...).Run() ) but not the one that was found, child Page object is never found for Browser_A object and thus expression fails.

 

The simplest way to solve this problem, especially if you prefer the concept of only one browser running in the system during test, is to check if any browser is running in the system and close it before launching a browser against tested web page.

 

Sample untested code for above might be like this:

var browser = Aliases.WaitNamedChild('Browser', 500); // check if any browser is running

while (browser.Exists)

{

  browser.Close();

  if (browser.Exists)

    browser.Terminate();

 

  browser = Aliases.WaitNamedChild('Browser', 500);

}

 

Browsers.Item(...).Run(url);

 

 

Hope that above will help.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
bhcommunity1
Occasional Contributor

Re: Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page(

There is still something else going on.  What you suggested (closing down browsers), I already had in place.  

 

1) We current use the eventhandler = TestEngineEvents_OnStartTestCase

 

function TestEngineEvents_OnStartTestCase(Sender, StartTestCaseParams)
{
CommonUtils.closeAllBrowsers2();
aqUtils.Delay("2000");
}

Note: I added the aqUtils.Delay("2000"); statement just last night to see if there was an additional timing issue.  But didn't fix it.

bhcommunity1_0-1616078901724.png

2) When I run a series of tests with Firefox I see results like the following.

bhcommunity1_1-1616079154614.png

 

Everything worked fine for a couple tests but then ran into same issue:

bhcommunity1_2-1616079221100.png

 

While it was in this state, I looked at Taskmgr.  The Firefox applications does have multiple sub-processes.

bhcommunity1_3-1616079322048.png

 

Any ideas?

AlexKaras
Community Hero

Re: Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page(

Hi,

 

CommonUtils.closeAllBrowsers2();

.Close() command not always ends the process. Especially with browser process. Thus I would try approach with .Terminate() that is described in the help article for the Close() method. (I also mentioned it in my previous reply.)

 

> TestEngineEvents_OnStartTestCase()

Are all your tests marked as test cases? Maybe OnStartTest event is better?

 

The Firefox applications does have multiple sub-processes.

This is a usual behavior of modern browsers.

 

P.S.

One more comment as for the code of closeAllBrowsers2() function:

> browsers[i].Close();

a) As it is documented, .Close() method does not return information of whether or not the process was actually closed. Thus, the next message (Log.Message("...Closed a browser.") ) is misleading as it confirms the action that possibly was not completed.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

bhcommunity1
Occasional Contributor

Re: Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page(

Still debugging, please don't close as of yet.

sonya_m
Community Manager

Re: Firefox - Inconsistent Launching of browser with URL value - keep running into Waiting for Page(

Thanks Alex!🙂

 

@bhcommunity1 did Alex's advice help?

 

I'll mark his suggestion as a temporary solution, please do share your results here!


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors