0
@AndroidFindBy(id="com.com-uat:/id")
private MobileElement id;

Here my resource id has a packageName, but my packageName changes depending on the environment for ex Uat- com.com-uat prod- com.com.prod.

Now how do I make it dynamic.

1 Answers1

1

There is no way to dynamically generate a string in annotation.

I checked AndroidFindBy annotation and I don't see an easy way to extend it the way it will support different values based on env.

But generally you are not required to pass package name in a value, id should be enough:

@AndroidFindBy(id="nome_button")
private MobileElement homeButton;

should work the same way as if you define it

@AndroidFindBy(id="com.com-uat:id/home_button")
private MobileElement homeButton;

You need to provide package when it is Android native element, but in that case it will be the same for UAT and PROD:

@FindBy(id = "android:id/text1")
private WebElement textView;
dmle
  • 3,498
  • 1
  • 14
  • 22