How can I exit a sub (macro) without close browser window? When code finish Chrome browser automatically close.
For example I have
Sub test()
Dim dri
The browser is automatically disposed once the variable of the driver is out of scope. For further information, I invite you to have a look at the official documentation: https://support.microsoft.com/en-gb/kb/141693
So, to avoid quitting the browser, you need to set the instance of the driver on a global variable:
Private Assert As New Assert
Private driver As New Selenium.FirefoxDriver
Sub ProcMain()
driver.Get "http://stackoverflow.com"
Call ClickLogo
End Sub
Sub QuitDriver()
driver.Quit
End Sub
Sub ClickLogo()
driver.FindElementByCss("#hlogo").Click
End Sub
To get the latest version in date working with the above example: https://github.com/florentbr/SeleniumBasic/releases/latest