Author - StudySection Post Views - 25 views
Selenium testing python

Testing Of Links With Selenium Tool In Python

In this content, we will perform Selenium testing on links that are present on the web page. Some operations to be performed on the web page for testing the given links are:

  1. The first operation is to find out all links that are present on the web page.
  2. The second operation is to Capture the link.
  3. The third operation is to Click on the link.

from selenium import webdriver
from import By
from selenium.webdriver.common import keys

for link in links:

The above code will print the total number of links present on the web page and will also print the test of those links. The output is shown below with web page:



If we will use ‘link.text’ instead of ‘link’ then it will print the provided text of links on the web page as shown.

To perform a click operation on the given link we will use this command:

aboutus=driver.find_element(By.LINK_TEXT,"About Us").click()

This command will capture the link text ‘About Us’ on the web page and will perform a click operation on it. We can also use partial link text by using the given command.

This command also performs the click operation on the About Us link on the web page.
This will show the two output tabs in the same window as shown in which the first tab is a parent and the second is the ’About Us’ page of the parent web page.

Study Section provides a big list of certification exams through its online platform. The French Certification Exam can help you to certify your skills to communicate in the French language. Whether you are new to the language or you are an expert in it, this French certification exam can test the ability of anybody’s command over the French language.

Leave a Reply

Your email address will not be published. Required fields are marked *