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:







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA