I have made a series of Keyword Tests. Each test Closes the Browser at the end of the test. Each Keyword Test runs without error individually.
I have added the Keyword Tests to my Test Project and when I try and run the Test Project, on the start of the 2nd test I get the error "The Browser is already running." and "Cannot obtain the window with the window class 'IEFrame', window caption '*' and index 0." and the test stops.
I have verified that indeed the Browser was closed at the end of the 1st test and before the 2nd test is started. Also no other browsers are running.
Why am I getting this error and how do I get around it so that all tests will run in succession?
The second variant is preferable, as it can close all running browsers, rather than just one we used in a test.
Artem SmartBear Technical Writer ----- I’m not a member of the SmartBear Support Team, I’m just helping users in this community. Any views or opinions expressed do not necessarily represent those of SmartBear Software.
RE: Why do I get "The Browser is already running." ?
The problem that I see in my tests with the code below is that the Browser.Close has already been executed, but TC still thinks that the Browser is still running for some reason.
With the code below, sometimes the Sys.WaitBrowser() still Exists, but before the Sys.WaitBrowser.Close can be executed, the Browser object being close no longer exists, and I get an error message to that effect. This is an error prone way to handle this.
There needs to be some error free way of running a series of tests in succession that Launch an IE browser at the beginning, and Close the Browser at the end of the tests.
The Browser.Close statement should not return until the Browser is Closed.
The Call Browsers.Item(btIExplorer, "", Browsers.pX64).Run statement should launch a new Browser or use the existing Browser without requiring that ALL Browsers on the system be Closed and Garbage collected Before it is executed.
The workarounds for this issue are just exposing additional levels of errors.
How can I design my tests so that they will run in quick secession without any errors? Each test starts by launching a Browser, and each test ends by Closing the Browser.
How can I make sure that launching the Browser will execute without error?
How can I make sure that the Browser.Close has completed?