Search code examples
javaselenium-webdriverserenity-bddappium-java

Serenity BDD get UID of WebelEmentFacade


I am testing Android and IOS applications, and i have an issueto get the UID of an element.

When i evaluate the element on Intellij, i have those key and value : Evaluation of element

What i want is to get the value of "id", but i tried a lot of things, and Serenity doesn't know getAttribute("UID") or getAttribute("elementId") or getAttribute("id")

This is what i write for my element : Element declaration

And this the method who use the elementId i need : Methode which use elementId this method works with the actual remote element but i want the Serenity WebElementFacade for some reasons, but it's not compatible with remoteElement

Any idea ? Thanks a lot in advance for your help !


Solution

  • I just answer my question with this code (thanks to github copilot !!! XD )

    public static String getWebelementId(WebElementFacade webElementFacade) {
        RemoteWebElement remoteWebElement = (RemoteWebElement) webElementFacade.getWrappedElement();
        return remoteWebElement.getId();
    }
    

    if this can help anyone !