terminating multiple browsers
Tired of wrestling with Silk's built-in recovery system's handling of multiple browser windows at testcase startup? Tired of the illogical delays while Browser2.BuiltinClose() waits for 90 seconds to terminate Browser2? Tired of having the main application's window terminated, while leaving the 2nd browser window open--especially when that browser window does not contain a toolbar or URL address field?
Then consider adding the following code at the top of a custom TestCaseEnter() function in your framework:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">. if (Browser2.Exists(.5))
. LogWarning("WARNING: multiple browsers are open, closing all of them..."
. while (Browser.Exists(.5))
. Browser.Kill() // [undocumented, but reliable]
. sleep (1) // let just killed browser's process die
. Browser.Invoke() // now start a single new browser
. SetAppState () // invoke built-in recovery
. etc.</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">With much testing today this code has proven to be very fast and reliable [even when more than 2 browsers are open], and you only pay runtime penalty when a testcase starts with more than one browser window open.
I am beginning to think this is what the built-in recovery system should do.
-Hope this helps others, Terry Horwath