Chrome Crashing with Selenium

Hello,

I’m working through the 11-8 exercise where the goal is to use selenium to open a webpage and ultimately login.

I’m running into the issue where the script executes and opens chrome for a split second and then immediately closes it. I put the chromedriver in C:\Windows and my original code is below along with the edit I tried based on recommendations from older posts elsewhere online. Any help is appreciated.

from selenium import webdriver

browser = webdriver.Chrome()
browser.get(“https://github.com”)

from selenium import webdriver # with edit
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_experimental_option(“detach”, True)
browser = webdriver.Chrome()
browser.get(“https://github.com”)

The issue here is that you did not add the options into the Chrome() function. So you need do:

browser = webdriver.Chrome(options=options)