Skip to content
Advertisement

Check if the browser opened with Selenium is still running (Python)

I want to check if a browser opened with Selenium is still open. I would need this check for closing a program. If the browser is not open, then the GUI should be destroyed without a message (tk.messagebox) coming. But if the browser is open, then the message should come as soon as the function is activated.
Here is the function:

JavaScript

Advertisement

Answer

I don’t think there is a direct api for checking browser status. But you can use the the work around

JavaScript
Advertisement