I need to find an element by xpath, but some part of xpath always changes and I need to add it directly during the test. If I add annotation @Setter to my Selenide element and try to set a new xpath with String, I always receive an error that I can pass only Selenide element. How can I do it?
String test;
@Setter
@FindBy(xpath = "//div[contains(text(),"+test+"]")
private
SelenideElement orgCard;
And here I try to pass String to the xpath:
public static void setXpath( String orgName){
OrganizationsPage.getInstance().setTest("//div[contains(text()," + orgName + "']");
}
You can write a method and pass a needed argument to it:
But I also suggest to look at some examples, e.g. there https://github.com/selenide-examples/google