Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Python Selenium Detach Option Not Working

$
0
0

I want to write a Python script using Selenium and Chrome where Selenium won't close the Chrome browser when the script finishes. From doing a bunch of googling, it looks like the standard solution is to use the detach option. But when I run the following script:

import seleniumfrom selenium import webdriverfrom selenium.webdriver.chrome.options import Optionschrome_options = Options() chrome_options.add_experimental_option("detach", True)driver = webdriver.Chrome(options=chrome_options)driver.get("https://www.google.com/")

It opens up Chrome, goes to Google's homepage, and then closes the browser. It's not throwing any errors.

Any idea why it's not working? I'm using the latest version of Google Chrome on Windows 10, and I've got the latest version of the selenium module installed. I couldn't find anything online that said the experimental detach option no longer existed. And I double checked the API, and it looks like it's the right syntax.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>