Javatpoint Logo
Javatpoint Logo

Locating Strategies- (By XPath- Using text())

In this section, you will learn how to locate a particular web element by XPath- Using text() method.

"text() method" is used to identify an element based on the text available on the web page.

Let us consider an example in which we will try to locate the text "Google offered in" on the default page of Google Search engine.

Locating Strategies- By XPath- Using text()

The syntax for locating elements through XPath- Using text() method can be written as:

Using XPath- text() method, we can write the Java code along with the dynamic XPath location as:






Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA