Reputation: 63
So I'm using Python 3.9.5 Everytime I use the driver.get function, chrome appears for a second and then immediately closes the window. How do I make it like it stays open? It used to work, but when I closed VSCode and re-opened it, I did something that made it so that chrome doesn't appear to be opened.
Upvotes: 3
Views: 1196
Reputation: 385
I think you can solve this by adding the detach option.
For example:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
Upvotes: 3
Reputation: 355
Check the logs for more information. Sometimes your web browser has been updated and the chromedriver does not match with the version, so, you have to download the specific version of your browser.
Upvotes: 0