Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close the existing browser tab using the Python webbrowser package

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

like image 964
karthik.zorfy Avatar asked May 19 '15 12:05

karthik.zorfy


People also ask

How do you close a tab in webbrowser using Python?

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 change my default browser in webbrowser Python?

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.


1 Answers

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

like image 57
XiR_ Avatar answered Sep 20 '22 03:09

XiR_