title: Google chrome closes immediately after being launched with selenium
body: <p>I am on Mac OS X using selenium with python 3.6.3.</p>
  
  <p>This code runs fine, opens google chrome and chrome stays open.:</p>
  
  <pre><code>chrome_options = Options()
  chrome_options.binary_location="../Google Chrome"
  chrome_options.add_argument("disable-infobars");
  driver = webdriver.Chrome(chrome_options=chrome_options)
  
  driver.get("http://www.google.com/")
  </code></pre>
  
  <p>But with the code wrapped inside a function, the browser terminates immediately after opening the page:</p>
  
  <pre><code>def launchBrowser():
     chrome_options = Options()
     chrome_options.binary_location="../Google Chrome"
     chrome_options.add_argument("disable-infobars");
     driver = webdriver.Chrome(chrome_options=chrome_options)
  
     driver.get("http://www.google.com/")
  launchBrowser()
  </code></pre>
  
  <p>I want to use the same code inside a function while keeping the browser open.</p>