Forum Discussion
dmiscannon
10 years agoFrequent Contributor
The above article provides how to check if the browser is still open and to close all open browsers, both from keyword and script tests. Add these steps to you test and see if it helps when running them from TestExecute.
djadhav
10 years agoRegular Contributor
I add all the browsers I use for testing to the TestedApps section. The at the end of every test I run this routine to close the browsers as required.
'closes the tested browser
FUNCTION lib_closeBrowser(browserType)
DIM testedAppIndex
testedAppIndex = TestedApps.Find(browserType)
'find index of the tested browser
IF NOT (testedAppIndex < 0) THEN
Log.Message("Closing browser : " & browserType)
IF Sys.WaitBrowser(browserType,3000).Exists THEN
TestedApps.Items(testedAppIndex).Close
END IF
IF Sys.WaitBrowser(browserType,2000).Exists THEN
TestedApps.Items(testedAppIndex).Terminate
END IF
IF Sys.WaitBrowser(browserType,1000).Exists THEN
CALL kill_Browser(browserType)
END IF
ELSE
Log.Error("Closing browser : " & browserType & " : ERROR: Application not found")
END IF
END FUNCTION
'CALL function like this
lib_closeBrowser("iexplore")
lib_closeBrowser("chrome")
lib_closeBrowser("firefox")