I am using Serenity for automation tests. I used before the plain WebDriver and PageObject pattern. I thought to switch to Serenity for the high API availability and Screenplay pattern. I encountered a problem using the Screenplay pattern:
actor.attemptsTo(Ensure
.that(target)
.isDisplayed());
Question: Is there a way to pass the current PageObject or a WebElementFacade to the Target or where is used the Target. So I would like to avoid for searching the entire DOM. Also there can be cases multiple elements are present so it is required to limit the searching area in the DOM.
I achieved this thing with the WebDriver and PageObject pattern easily. I searched within the PageObject's WebElement. I used nested PageObjects in order to define a Page and reuse the common components.
You can seach relative to a target using element.inside("your locator"). Would that help?