I am testing my first program for running selenium using python in Chrome version 92
My code at the moment is:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_experimental_option("detach", True)
options.add_argument("start-maximized")
options.add_argument("--auto-open-devtools-for-tabs")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
driver = webdriver.Chrome(
options=options,
executable_path=r"./chromedriver.exe",
)
driver.get("https://www.python.org")
print(driver.title)
After I run this code, it automatically closes the browser which I want it to remain open. The Chrome driver I am using is for my Chrome version 92 if that helps in any way.
Is there any code I am missing here?
EDIT: The terminal output by the way is:
DevTools listening on ws://127.0.0.1:55201/devtools/browser/829b2f58-670c-4d08-a725-193117104c2f
Welcome to Python.org