so as you all know that today life is nothing without internet, and it feels really boring sometimes when you are making programs which have no use or no direct implementation in real life.
So when we talk about python, it is a vast language and you can do a lot if things using python is just few lines. In this blog i will tell you how you can work on browsers with python.
so if you are my regular follower you must listen about selenium which i used to do automate things. so similar their are some packages which help us to work with browsers and these packages are:
webbrowser: Comes with Python and opens a browser to a specific page.
Requests: Downloads files and web pages from the Internet.
Beautiful Soup :Parses HTML, the format that web pages are written in.
Selenium: Launches and controls a web browser. Selenium is able to fill in forms and simulate mouse clicks in this browser
so how to use webbrowser
simply first you have to import webbrowser in your program just by typing
import webbrowser
and after that if you want to open the browser then on the next line you have
to type
webbrowser.open("any link here")
inside the double quotes you have to type any link you want to open.
example:
>>> import webbrowser
>>> webbrowser.open("https://www.google.com")
the above code will open a tab on the default browser set on your computer with the website google.com
So when we talk about python, it is a vast language and you can do a lot if things using python is just few lines. In this blog i will tell you how you can work on browsers with python.
so if you are my regular follower you must listen about selenium which i used to do automate things. so similar their are some packages which help us to work with browsers and these packages are:
webbrowser: Comes with Python and opens a browser to a specific page.
Requests: Downloads files and web pages from the Internet.
Beautiful Soup :Parses HTML, the format that web pages are written in.
Selenium: Launches and controls a web browser. Selenium is able to fill in forms and simulate mouse clicks in this browser
so how to use webbrowser
simply first you have to import webbrowser in your program just by typing
import webbrowser
and after that if you want to open the browser then on the next line you have
to type
webbrowser.open("any link here")
inside the double quotes you have to type any link you want to open.
example:
>>> import webbrowser
>>> webbrowser.open("https://www.google.com")
the above code will open a tab on the default browser set on your computer with the website google.com
Comments
Post a Comment