java-client icon indicating copy to clipboard operation
java-client copied to clipboard

Widget: Not all element look up options work when using multiple locators

Open wazzeps opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

Suppose we have 2 locators to look up a widget and 2 locators to look up a nested widget element.

In this case, looking up is performed only by the combinations

  • first widget locator + first element locator
  • first widget locator + second element locator

and the other two combinations are ignored

  • second widget locator + first element locator
  • second widget locator + second element locator

Expected Behavior

Looking up is performed on all 4 options

  • first widget locator + first element locator
  • first widget locator + second element locator
  • second widget locator + first element locator
  • second widget locator + second element locator

Minimal Reproducible Example

@HowToUseLocators(androidAutomation = LocatorGroupStrategy.ALL_POSSIBLE) @AndroidFindBy(id = "widget1") @AndroidFindBy(id = "widget2") private SomeWidget widget;

@HowToUseLocators(androidAutomation = LocatorGroupStrategy.ALL_POSSIBLE) @AndroidFindBy(id = "element1") @AndroidFindBy(id = "element2") private WebElement element;

Calling a method on the element with its widget which can only be found by the second locator will throw NoSuchElementException.

Environment

  • OS: Ubuntu 22.04.1 LTS
  • Appium Desktop: v1.22.3-4
  • Appium driver: UIAutomator2
  • Platform: Android API level 30
  • Emulator

Link to Appium Logs

No response

Futher Information

No response

wazzeps avatar Dec 11 '22 08:12 wazzeps

Does trying the following style yield any different results?

@AndroidFindAll({
  @AndroidBy(id = "widget1"),
  @AndroidBy(id = "widget2")
})
private SomeWidget widget;

@AndroidFindAll({
  @AndroidBy(id = "element1"),
  @AndroidBy(id = "element2")
})
private WebElement element;

Auto81 avatar Jan 03 '23 16:01 Auto81