Home » WebDriver Locating Strategies By XPath Using OR

WebDriver Locating Strategies By XPath Using OR

by Online Tutorials Library

Locating Strategies- (By XPath- Using Or)

In this section, you will learn how to locate a particular web element by XPath- Using Or.

Let us consider an example in which we will try to locate the Google Search Engine Text box by XPath- Using Or.

Follow the steps given below to locate the textbox provided on the home page of Google Search Engine.

  • Open URL: https://www.google.co.in/ in your Firefox browser
  • Right click on the Textbox on the sample web page and select Inspect Element

Locating Strategies- By XPath- Using Or

  • It will launch a window containing all the specific codes involved in the development of the textbox.

Locating Strategies- By XPath- Using Or

  • Take a note of its id and Class Attribute.

Locating Strategies- By XPath- Using Or

The syntax for locating elements through XPath- Using Or can be written as:

or

Using XPath-Or, we can write the Java code along with the dynamic XPath location as:

You may also like