For example, I have an element1 which I can find after I find element2, like this:
driver.findElement(By.xpath("//xpath2")).findElement(By.xpath("//xpath1")).click();
I want to use PageObjectModel and annotations @FindBy, like these:
@FindBy(xpath = "//xpath1")
private WebElement element1;
@FindBy(xpath = "//xpath2")
private WebElement element2;
The problem: I don't know how to rewrite the code, this doesn't work:
element2.element1.click();