1

I have searched and found this for Python.

Is there a way to keep the driver bot open after executing the code?

I know I can use Stop at the end but I am searching for that direct way to end the code and at the same time keep the browser open.

Community
  • 1
  • 1
YasserKhalil
  • 9,138
  • 7
  • 36
  • 95

1 Answers1

3

I have worked around and it is solved by declaring the driver in the declaration section

Private bot As New Selenium.ChromeDriver

Sub Test1()
bot.get "https://www.google.com"
End Sub

Sub Test2()
bot.get "https://www.facebook.com"
End Sub

Sub QuitBott()
bot.Quit
Set bot = Nothing
End Sub

But I welcome any other solutions

YasserKhalil
  • 9,138
  • 7
  • 36
  • 95
  • Tests should be run independently. Each test should have its own browser instance to better insulate each script run. – JeffC Dec 07 '18 at 19:53
  • @JeffC Thanks a lot for reply. The target is to keep the browser open regardless to navigate to other urls. If there is a way better, I would welcome other solutions – YasserKhalil Dec 07 '18 at 19:57