Home » WebDriver Locating Strategies By XPath Using last()

WebDriver Locating Strategies By XPath Using last()

by Online Tutorials Library

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

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

“last() method” selects the last element (of mentioned type) out of all input element present.

Let us consider an example in which we will try to locate the last text field on the Google sign-up page i.e. “Confirm Password” field.

Locating Strategies- By XPath- Using last()

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

You may also like