Python | Launch a Web Browser using webbrowser module Last Updated : 31 Oct, 2021 Comments Improve Suggest changes Like Article Like Report In Python, webbrowser module is a convenient web browser controller. It provides a high-level interface that allows displaying Web-based documents to users. webbrowser can also be used as a CLI tool. It accepts a URL as the argument with the following optional parameters: -n opens the URL in a new browser window, if possible, and -t opens the URL in a new browser tab. Python python -m webbrowser -t "https://www.google.com" NOTE: webbrowser is part of the python standard library. Therefore, there is no need to install a separate package to use it. The webbrowser module can be used to launch a browser in a platform-independent manner as shown below:Code #1 : Python3 import webbrowser webbrowser.open('http://www.python.org') Output : True This opens the requested page using the default browser. To have a bit more control over how the page gets opened, use one of the following functions given below in the code -Code #2 : Open the page in a new browser window. Python3 webbrowser.open_new('http://www.python.org') Output : True Code #3 : Open the page in a new browser tab. Python3 webbrowser.open_new_tab('http://www.python.org') Output : True These will try to open the page in a new browser window or tab, if possible and supported by the browser. To open a page in a specific browser, use the webbrowser.get() function to specify a particular browser.Code #4 : Python3 c = webbrowser.get('firefox') c.open('http://www.python.org') c.open_new_tab('http://docs.python.org') Output : True True Being able to easily launch a browser can be a useful operation in many scripts. For example, maybe a script performs some kind of deployment to a server and one would like to have it quickly launch a browser so one can verify that it’s working. Or maybe a program writes data out in the form of HTML pages and just like to fire up a browser to see the result. Either way, the webbrowser module is a simple solution. Comment More infoAdvertise with us Next Article Python | Launch a Web Browser using webbrowser module M manikachandna97 Follow Improve Article Tags : Python python-utility python-modules Practice Tags : python Similar Reads Python Script to Open a Web Browser In this article we will be discussing some of the methods that can be used to open a web browser (of our choice) and visit the URL we specified, using python scripts. In the Python package, we have a module named webbrowser, which includes a lot of methods that we can use to open the required URL in 4 min read Controlling the Web Browser with Python In this article, we are going to see how to control the web browser with Python using selenium. Selenium is an open-source tool that automates web browsers. It provides a single interface that lets you write test scripts in programming languages like Ruby, Java, NodeJS, PHP, Perl, Python, and C#, et 3 min read Launch Website URL shortcut using Python In this article, we are going to launch favorite websites using shortcuts, for this, we will use Python's sqlite3 and webbrowser modules to launch your favorite websites using shortcuts. Both sqlite3 and webbrowser are a part of the python standard library, so we don't need to install anything separ 3 min read Launch an HTTP Server with a Single Line of Python Code Python, with its built-in capabilities, offers a simple and effective way to do this. With just a single line of code, you can launch an HTTP server to serve files from your local directory. This feature can be incredibly handy for developers, educators, and anyone needing a quick and easy way to sh 2 min read create_web_element driver method - Selenium Python Seleniumâs Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout â Navigating links using get method â Selenium Python. Just bein 2 min read How to use close() and quit() method in Selenium Python ? While doing stuff with selenium multiple browsers with multiple tabs will normally opens in order to close these tabs close() and quit() methods are used. 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 drive 2 min read Web Driver Methods in Selenium Python Seleniumâs Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout â Navigating links using get method â Selenium Python. Just bein 5 min read Requesting a URL from a local File in Python Making requests over the internet is a common operation performed by most automated web applications. Whether a web scraper or a visitor tracker, such operations are performed by any program that makes requests over the internet. In this article, you will learn how to request a URL from a local File 4 min read How to Build Web scraping bot in Python In this article, we are going to see how to build a web scraping bot in Python. Web Scraping is a process of extracting data from websites. A Bot is a piece of code that will automate our task. Therefore, A web scraping bot is a program that will automatically scrape a website for data, based on our 8 min read Python Easy-Login Module Easy-Login module is that library of Python which helps you to login in your social accounts like Facebook, Instagram, Twitter, Linkedin, Reddit etc through Python without opening the sites manually . Installation This module does not come built-in with Python. You need to install it externally. To 2 min read Like