Forum Discussion
dbaechtel
12 years agoContributor
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?
Code that does not always work without error:
Sub Check
While Sys.WaitBrowser().Exists
Call Sys.WaitBrowser().Close()
Wend
End sub
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?
Code that does not always work without error:
Sub Check
While Sys.WaitBrowser().Exists
Call Sys.WaitBrowser().Close()
Wend
End sub