'Chrome closing immediately using simple Selenium script

This is literally all my code is- followed a beginner tutorial video

from selenium import webdriver

driver = webdriver.Chrome()

url = 'http://google.com'

driver.get(url)

It's supposed to open chrome and remain open, but it closes immediately. When I use time.sleep(10) it does stay for 10 seconds, but closes after. How can I keep the browser until I close it?



Solution 1:[1]

Solved - for some reason some unused "import" lines at the top of the code were the issue. I deleted them

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M P