SELENIUM BASICS:


SELENIUM WEBDRIVER:


TESTNG:


REPORTS:


BUILD & CONTINUOUS INTEGRATION TOOLS:


CROSS BROWSER TESTING:


MOBILE TESTING:


AUTOMATION FRAMEWORKS:


API Testing:


INTERVIEW QUESTIONS:


SAMPLE RESUME:

How To Locate Element By Tag Name Locator In Selenium

In the previous post we have seen “locators in Selenium“. In this post, we discuss “How To Locate Element By Tag Name Locator”. Find the below links on How to find elements on a web page using different types of locators.

1. “How To Locate Element By ID Locator
2. “How To Locate Element By Name Locator
3. “How To Locate Element By Class Name Locator
4. “How To Locate Element By Link Text/Partial Link Text Locator
5. “How To Locate Element By CSS Selector Locator
6. “How To Locate Element By XPath Locator

Coming to the actual post “How To Locate Element By Tag Name Locator”.

Tag Name Locator:

Tag Name locator is used to find the elements matching the specified Tag Name. It is very helpful when we want to extract the content within a Tag.

Syntax:

Script Explanation: 

Copy the below mentioned script and execute in your system. It executes as mentioned below:

  1. Opens Firefox Browser
  2. Navigates to Google.com
  3. Here we used, tagName(“a”) to get the links and used findElements method to store the list of all links on the google.com page
  4. Prints the size of total no. of links
  5. Print s the list of all the links available on the page

Value to be added in the By.tagName method:

Script:

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

1 thought on “How To Locate Element By Tag Name Locator In Selenium”

Leave a Comment

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

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE