Google chrome closes immediately after being launched with selenium

后端 未结 8 989
说谎
说谎 2021-01-19 09:37

I am on Mac OS X using selenium with python 3.6.3.

This code runs fine, opens google chrome and chrome stays open.:

chrome_options = Options()
chrome         


        
8条回答
  •  无人共我
    2021-01-19 10:03

    The browser is automatically disposed once the variable of the driver is out of scope. So, to avoid quitting the browser, you need to set the instance of the driver on a global variable:

    Dim driver As New ChromeDriver
    
    Private Sub Use_Chrome()
    
    driver.Get "https://www.google.com"
    '  driver.Quit
    End Sub
    

提交回复
热议问题