Skip to content
Advertisement

Python Selenium Detach Option Not Working

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:

JavaScript

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.

Advertisement

Answer

This code worked perfectly for me using : selenium-wire , hope it works for you

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement