title: Chrome browser closes automatically when run chromedriver inside a method/function
body: <p>I was trying to run some selenium test in chrome browser in Pycharm IDE.I wrote the chrome driver inside a function &amp; when i tried to run the code it opened up the  browser and closed automatically within a sec.But when I wrote the chrome driver outside the function it open the browser and didnot close. How do i manage to keep the browser open if I write the chromedriver code inside a method/function?</p>
  
  <p>Code:</p>
  
  <pre><code>from selenium import webdriver
  import os
  
  class Chrome:
      def Run(self):
          driverLocation="F:\\Workspace py\chromedriver\chromedriver.exe"
          os.environ["webdriver.chrome.driver"] = driverLocation
          driver = webdriver.Chrome(driverLocation)
          driver.get("https://www.google.com")
  
  
  Test=Chrome()
  Test.Run()
  </code></pre>