launchSpecificBrowser "CR", OPSENVURL, OPSBROWSERTIMEOUT Public Function launchSpecificBrowser(browserType, url, timeout) Dim bObj, blankPage blankPage = "about:blank" ' make sure that any open browser is closed first. killAllBrowserInstances(browserType) Select Case browserType Case "CR" ' reset the browser settings before restarting the browser at the specified page systemutil.Run "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", blankPage bObj = fWaitToExist(Browser("title:=.+"), timeout) If bObj Then ' reset the browser settings before restarting the browser at the specified page 'Browser("title:=.+").ClearCache <- doesn't seem to work for Chrome. Browser("title:=.+").DeleteCookies killAllBrowserInstances(browserType) Reporter.ReportEvent micPass, "Clear Browser", "Browser Reset" systemutil.Run "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", url bObj = fWaitToExist(Browser("title:=.+"), timeout) If bObj Then Reporter.ReportEvent micPass, "Start Browser", "Browser Present" Else Reporter.ReportEvent micFail, "Start Browser", "Browser Not Present" ExitTest End if Else Reporter.ReportEvent micFail, "Clear Browser", "Browser Not Present" ExitTest End If End Select ' put the mouse somewhere where it won't interfere with replay (bottom leftish) Dim deviceReplayObject Set deviceReplayObject = CreateObject("Mercury.DeviceReplay") Call deviceReplayObject.MouseMove(2, Window("regexpwndtitle:=Program Manager").GetROProperty("height") - 2) Set deviceReplayObject = nothing End Function Public Function fWaitToExist( obj, timeOutSeconds ) Dim loopCount Dim objNotPresent, notTimedOut, thisLoop thisLoop = 1 loopCount = timeOutSeconds Do objNotPresent = not obj.Exist(0) If objNotPresent Then thisLoop = thisLoop + 1 wait 1 End If If thisLoop = loopCount Then notTimedOut = False Else notTimedOut = True End If Loop While objNotPresent and notTimedOut If not notTimedOut Then ' it did timeout! Reporter.ReportEvent micFail, "Missing Object", "Object did not appear within " & timeOutSeconds & " sec" fWaitToExist = False Else fWaitToExist = True End If End Function