public static WebElement selectcity(String cityname)
     WebElement city;
     return city;

Trying to select city dynamically. When used in above fashion I'm facing the below issues:

  1. The value for annotation attribute AndroidFindBy.xpath must be a constant expression

  2. The annotation @AndroidFindBy is disallowed for this location

Could someone please help me on this?

1 Answer 1


Page factory doesn't support dynamic webelements

    Webelement elem= driver.findElememt(By.xpath("locator"));

Use driver.findelemtns instead

See the status , pagefactory is marked as won't fix



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.