appium / appium/java-client

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

Open
#1,816 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the issue with the two @HowToUseLocators and @AndroidFindBy groups, then trace the locator-grouping entry point used when calling a nested widget element. Done means all four widget/element locator combinations are attempted and a regression test covers the second-widget-locator case.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.