I have a text element on the page with properties:
And I'm trying to get this element using FindBys annotation:
@FindBys({@FindBy(tagName = "h5"),@FindBy(id = "email_label")})
private WebElement EmailLabel;
but getting error: org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.chained({By.tagName: h5,By.id: email_label})
At the same time element is found properly if use just one condition:
@FindBys({@FindBy(id = "email_label")})
private WebElement EmailLabel;
or
@FindBys({@FindBy(tagName = "h5")})
private WebElement EmailLabel;
I use:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.141.59</version>
</dependency>