Ask a Question

Browser.Page(mypage).close() in edge


Browser.Page(mypage).close() in edge



I experience a strange behaviour in edge executing the following code:


   function cleanUpWorld()
      var testedBrowser = ProjectSuite.Variables.testedBrowser;
      var cleanupScriptUrl = ProjectSuite.Variables.BaseURL + "tools/testing_start_apo.php";
      //  Checks if the currently for test runs used browser is already running.
      if(! Sys.WaitBrowser(testedBrowser).Exists)
        //  If the browser is not running, starts it.
      //  Opens a new tab.
      //  Opens URL to run the php cleanup script "testing_start_apo.php".
      //  Closes the tab in which the url was opened.

When executing the function in Internet Explorer, everything works just fine. A new tab is opened, in that new tab the page with the correct url is opened, the tab is closed and Internet Explorer stays active.


When executing the function in Edge, when the tab in which the url was opened shall be closed, both the page and the browser are closed, instead of the page only.


When I execute the test operations manually without TestComplete, Edge behaves as it should and stays open.


The following picture shows both test logs, one for a test run with Edge, one for a test run with Internet Explorer:


log both.jpg

Both browsers were prepared for testing as described in the Test Complete documentation. When Edge is used in TestComplete options the checkbox is checked for "Enable support for testing Windows Store applications".


Does anyone know why the whole edge browser is closed instead of the page only?

Community Hero



I see one additional event came for Edge. Where it is going when you double click the entry highlighted in below image


Shankar R

LinkedIn | CG-VAK Software | Bitbucket |

“You must expect great things from you, before you can do them”

Extension Available



the German expression in the highlighted log entry "und 1 weitere Seite" is in English "and 1 additional page".

When I double click the highlighted entry it is going to the last line of script code:



When I double click the last log entry it is going to the very same line of code.

Esteemed Contributor

Best guess is that, what is happening, is that when you tell the test to go to the new URL for the clean up script, that is occurring, not on the new tab but potentially on the existing web page that is already open.  So, you really don't have two pages open, but a single one so, when you call the "Close" command, it closes the only page open which ends up closing the whole browser.  I'd do a bit of rework with your code to ensure that, when you open the new tab, you send your navigate code to that new page (probably your default home page or "blank" tab).

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

During a normal script run your guess is correct, indeed the url is called not in the new opened tab, but in the tab which was opened with the browser start. So here is really a behaviour to improve.

However when the script is run in debug mode the url is called correctly in the new tab. From that point on the problematic behaviour regarding closing the browser instead of the page only stays exactly the same.


During my investigation of the problem I had to notice more unpleasant behaviours of TestComplete with Edge. Objects are highlighted at different locations than they are visible on the screen, in object browser alert windows are not existent and the object browser does only show completely black pictures of the whole object hierarchy of the edge process.


Therefore I think it's better to open a support case.


Thank you for your help.



What version of TestComplete are you using?


> object browser does only show completely black pictures of the whole object

Yes. This is also the case for Chrome. My guess is that this is caused by browser's engine specifics...


> Objects are highlighted at different locations than they are visible on the screen might be the reason...

Also, if you are not using the latest version of TestComplete, check that Scaling Level for your display is set to 100% and page zoom is set to 100% as well.

  /Alex [Community Champion]
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.



I use the latest version of TestComplete, 12.30.1651.7.

The Favorites bar in edge is disabled and the browser was restarted.

Showing results for 
Search instead for 
Did you mean: