Kaliraj Subramanian
Kaliraj Subramanian

Reputation: 31

xpath OR operator for multiple values

For the following scenario, xpath OR operator is not working. The same label showing in different nodes in different pages.

@FindBy(xpath = "(//label[@class='x-form-item-label'])[19] | (//label[@class='x-form-item-label'])[36]")
public WebElement lblFee;

Upvotes: 3

Views: 404

Answers (1)

Florent B.
Florent B.

Reputation: 42518

Use the position() function with the or operator:

@FindBy(xpath = "(//label[@class='x-form-item-label'])[position()=19 or position()=36]")
public WebElement lblFee;

Upvotes: 2

Related Questions