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. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way. This article illustrates about how to use Selenium Python to navigate to any link on web using get method of Selenium Webdriver in python.
If you have not installed Selenium and its components yet, install them from here – Selenium Python Introduction and Installation.
How to navigate links using Python Selenium
The first thing one’ll want to do with WebDriver is navigate to a link. The normal way to do this is by calling get method:
WebDriver will wait until the page has fully loaded (that is, the onload event has fired) before returning control to your test or script. It’s worth noting that if your page uses a lot of AJAX on load then WebDriver may not know when it has completely loaded. If you need to ensure such pages are fully loaded then you can use waits.
Project Example –
After you have installed Selenium, create a file called run.py as –
- Python - Opening links using Selenium
- Python | page_source method in Selenium
- Python - find_element_by_id() method in Selenium
- How to use close() and quit() method in Selenium Python ?
- screenshot() element method - Selenium Python
- submit() element method - Selenium Python
- find_element_by_link_text() driver method - Selenium Python
- find_element_by_xpath() driver method - Selenium Python
- clear() element method - Selenium Python
- find_element_by_name() driver method - Selenium Python
- click() element method - Selenium Python
- find_element_by_partial_link_text() driver method - Selenium Python
- value_of_css_property() element method - Selenium Python
- location element method - Selenium Python
- screenshot_as_base64 element method - Selenium Python
- get_property() element method - Selenium Python
- add_cookie driver method - Selenium Python
- rect element method - Selenium Python
- text element method - Selenium Python
- size element method - Selenium Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.