Page Object Selector containing variable

Hi All,

I am trying to delare a page object element using a selector that contains a variable. But I keep getting an error saying:

“Attribute value must be constant”.

Is it not possible to use a variable here?

The reason for doing it is to find my date selector field which always shows today’s date.

I have tried the following 2 methods:

@AndroidFindBy(xpath = "//android.widget.TextView[@text='"+dateNow+"']")
private MobileElement dateOfBirth ;

//@AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().resourceId(\"com.gbg.verify.gbgtestapp:id/people_form_recyclerview\")).getChildByText(" + "new UiSelector().resourceId(\"com.gbg.verify.gbgtestapp:id/formElementValue\"), \""+dateNow+"\")")
//private MobileElement dateOfBirth ;

Thanks for any help as always :slight_smile: