# How to click on a link using Selenium webdriver in Python.

We can click on a link using Selenium webdriver in Python. A link is represented by the anchor tag. A link can be identified with the help of the locators like - link text and partial link text.

We can use the link text attribute for an element for its identification and utilize the method find_element_by_link_text. With this, the first element with the matching value of the given link text is returned.

Syntax

driver.find_element_by_link_text("value of link text")

We can also use the partial link text attribute for an element for its identification and utilize the method find_element_by_partial_link_text. With this, the first element with the matching value of the given partial link text is returned.

For both the locators, if there is no element with the matching value of the partial link text/link text, NoSuchElementException shall be thrown.

Syntax

driver.find_element_by_partial_link_text("value of partial ink text")

Let us see the html code of a webelement −

The link highlighted in the above image has a tagname - a and the partial link text - Refund. Let us try to click on this link after identifying it.

## Example

Code Implementation

from selenium import webdriver
driver = webdriver.Chrome(executable_path='../drivers/chromedriver')
#url launch
driver.quit()