sirping
3 years agoOccasional Contributor
Close Browser before Test
I need a Python script that closes Chrome if it is open before a Test
Currently I have a function looking like this
def closeBrowserIfOpen():
p = Sys.WaitBrowser("chrome", 0)
if (p.Exists):
p.Close()
else:
Log.Message("Browser Closed")
But even though I have 0 as the timeout parameter, the script still waits for the Browser for about 3 seconds. How can I get rid of this delay completely? I just want it to execute instantly. In the docu it says:
Timeout
The number of milliseconds to wait until the browser process becomes available. If Timeout is 0, the method returns immediately. If Timeout is -1, the wait time is specified by the Auto-wait timeout project setting.
But this is not true, since there is still a timeout of about 3 seconds while executing this code.
Btw: My Auto-wait timout is 40000.