Python – Opening links using Selenium

Selenium is a powerful tool for controlling the web browser through the program. It is functional for all browsers, works on all major OS and its scripts are written in various languages i.e Python, Java, C#, etc, we will be working with Python.

Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie, Chrome, Remote, etc. The currently supported Python versions are 2.7, 3.5 and above.

Installation

Selenium.get()

This method is used to launch a new browser and will open the given URL in the browser.

Syntax:



driver.get(url) 

Parameters used:
The function accept only one argument which is the desired link to be opened as showed in above syntax.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

#importing webdriver from selenium
from selenium import webdriver
   
#selecting Firefox as the browser
#in order to select Chrome 
# webdriver.Chrome() will be used
driver = webdriver.Firefox(executable_path = '/path/to/geckodriver')
   
#URL of the website 
   
#opening link in the browser
driver.get(url)

chevron_right


Output:

selenium-get

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.