I'm trying to use Page Object pattern in Java and having some trouble with @FindBy/XPath.
Earlier, I used the following construction in Groovy:
driver.findElement(By.xpath("//td[contains(text(),'$SystemName')]")).click()
Here, SystemName is a parameter that can be different.
Now, I want to do the same thing but in accordance with Page Object paradigm in Java:
public class ManagedSystems {
private WebDriver driver;
@FindBy(id="menu_NewSystem")
private WebElement menuNewSystem;
@FindBy (xpath = "//td[contains(text(),'$SystemName')]") // ??? How to use SystemName from deleteSystem method (below)?
private WebElement plantSystemName;
....
public SystemHomePage deleteSystem (String systemName) {
plantSystemName.click();
}
}
In my test, I call deleteSystem:
SystemHomePage.deleteSystem("Firestone");
Question: How to link @FindBy notation for PlantSystemName and SystemName specified for deleteSystem?
Thanks, Racoon