Skip to content

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

Open
@wazzeps

Description

@wazzeps

Is there an existing issue for this?

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions