Home » WebDriver Locating Strategies By XPath Using text()

WebDriver Locating Strategies By XPath Using text()

by Online Tutorials Library

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:

You may also like