Using Python webbrowser package I can open a new tab with a specified URL. Is there a way to close this tab? I referred the below official docs and nothing related to close action is mentioned.
Python webbrowser package doc: https://docs.python.org/3/library/webbrowser.html
close() method is used to close the current browser window on which the focus is set, on the other hand quit() method essentially calls the driver.
How do I make Chrome my default browser in Python? Following the documentation, there are a few directions you can go with this: Set the environment variable BROWSER. Use webbrowser. get('chrome') to get a controller instance of Chrome, then use that to do your browsing.
No, webbrowser doesn't have methods to close tabs nor browser itself as you may see in its documentation page: https://docs.python.org/2/library/webbrowser.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With