Hi All,
If I am using Selenium's @FindBy annotations to specify an id or xpath to look for (on an object that will later go through PageFactory.initElements(driver, this);
), is there any way I can output that information for debugging purposes?
For example, I have defined my fields...
@FindBy(id = "someId")
private WebElement someElement;
And created utility methods to manipulate those fields, such as
public void clickOnElement(WebElement element) {
if (LOG.isTraceEnabled()) {
LOG.trace("Will click on element [" + element.getTagName() + "].");
}
waitForClickableElement(element); // Uses FluentWait..
element.click();
}
The call to element.getTagName()
is preemptive and fragile above, because I am doing something that will access the field before I get a chance to even check if the field is present, let alone clickable. So, is there a way instead to access the @FindBy
information to output debugging information?
Rob
:)