Basically, I would like to make an assertion (from my test class) that a WebElement contains text(). Since all of my WebElements are defined in my page.class, I think I have to make them public to do this.
I am running into a few problems with the webdriver and elements, and I think it may be because multiple test classes are accessing WebElements from the page class simultaneously. My question is: Is there a reason the WebElements must be private?
Code example:
All PageFactory tutorials I have seen say to make your WebElements private, like
@FindBy(xpath = "//*[@id='searchStringMain']")
private WebElement searchField;
But to assert that an element contains text (from another class), I have to define them like this:
@FindBy(xpath = "(//*[contains (text(),'Hrs')])[2]")
public static WebElement yourLoggedTime;