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 XPath Locator In Selenium

In the previous post we have seen “locators in Selenium“. In this post, we discuss “How To Locate Element By XPath 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 Tag Name Locator
5. “How To Locate Element By Link Text/Partial Link Text Locator
6. “How To Locate Element By CSS Selector Locator

Coming to the actual post “How To Locate Element By XPath Locator”

XPath Locator:

XPath is designed to allow the navigation of XML documents, with the purpose of selecting individual elements, attributes, or some other part of an XML document for specific processing. XPath produces reliable locators but in performance wise it is slower (especially in IE older versions) compared to CSS Selector.

Syntax:

  1. Open Mozilla Firefox and navigate to Gmail application.
  2. Open Firebug and inspect the enter your email input box. Take a note of its ID. Follow the below screenshot to do so.
  3. Copy the below mentioned script and execute in your system.

Locate Element By XPath Locator

Value to be added in the By.xpath method:

Script:

Must Read: How To Write Dynamic XPath in Selenium

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

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