Skip to content

Java-client 8.0.0-beta2: Android: List<> annotation broken #1621

Closed
@amedvedjev

Description

@amedvedjev

The problem

We have element:

<android.widget.RelativeLayout index="1" package="my_app_package" class="android.widget.RelativeLayout" text="" resource-id="my_app_package:id/btn_move_money" checkable="false" checked="false" clickable="false" enabled="false" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,1428][720,1517]" displayed="true">

When we use:

@AndroidFindBy(id = "btn_move_money")
private List<WebElement> moveButton;

nothing found

When we use:

@AndroidFindBy(id = "btn_move_money")
private WebElement moveButton;

we can find element.

Environment

  • Appium version (or git revision) that exhibits the issue: 8.0.0-beta2
  • Last Appium version that did not exhibit the issue (if applicable): 7.6.0
  • Mobile platform/version under test: Android
  • Real device or emulator/simulator: real device with Android 11.0

Link to Appium logs

in first case we have:

2021-12-30 09:03:44:924 - [HTTP] {"using":"css selector","value":"#btn_move_money"}
2021-12-30 09:03:44:925 - [debug] [W3C (82f91e74)] Calling AppiumDriver.findElements() with args: ["css selector","#btn_move_money","82f91e74-47ba-4db7-930a-832647372789"]
2021-12-30 09:03:44:925 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
2021-12-30 09:03:44:925 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2021-12-30 09:03:44:925 - [debug] [WD Proxy] Matched '/elements' to command name 'findElements'
2021-12-30 09:03:44:925 - [debug] [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:5413/wd/hub/session/763cc841-6d55-4af1-a117-70988030a40c/elements] with body: {"strategy":"-android uiautomator","selector":"new UiSelector().resourceId(\"android:id/btn_move_money\")","context":"","multiple":true}
2021-12-30 09:03:44:956 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"763cc841-6d55-4af1-a117-70988030a40c","value":[]}
2021-12-30 09:03:44:957 - [debug] [W3C (82f91e74)] Responding to client with driver.findElements() result: []
2021-12-30 09:03:44:957 - [HTTP] <-- POST /wd/hub/session/82f91e74-47ba-4db7-930a-832647372789/elements 200 33 ms - 12

where resourceId(\"android:id/btn_move_money\") looks definitely wrong. we should use app package instead. OR! better use resourceIdMatches(".*:id/btn_move_money")

in first case we have:

2021-12-30 09:06:46:955 - [HTTP] {"using":"id","value":"btn_move_money"}
2021-12-30 09:06:46:955 - [debug] [W3C (b2e298e1)] Calling AppiumDriver.findElement() with args: ["id","btn_move_money","b2e298e1-1d57-4289-a665-5b5a31d27d02"]
2021-12-30 09:06:46:955 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
2021-12-30 09:06:46:956 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2021-12-30 09:06:46:956 - [debug] [WD Proxy] Matched '/element' to command name 'findElement'
2021-12-30 09:06:46:956 - [debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:5413/wd/hub/session/2d01eab5-acc1-4b6e-abde-a8698a5ff72b/element] with body: {"strategy":"id","selector":"btn_move_money","context":"","multiple":false}
2021-12-30 09:06:47:007 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"2d01eab5-acc1-4b6e-abde-a8698a5ff72b","value":{"ELEMENT":"00000000-0000-119e-ffff-ffff000006ff","element-6066-11e4-a52e-4f735466cecf":"00000000-0000-119e-ffff-ffff000006ff"}}
2021-12-30 09:06:47:007 - [debug] [W3C (b2e298e1)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"00000000-0000-119e-ffff-ffff000006ff","ELEMENT":"00000000-0000-119e-ffff-ffff000006ff"}
2021-12-30 09:06:47:008 - [HTTP] <-- POST /wd/hub/session/b2e298e1-1d57-4289-a665-5b5a31d27d02/element 200 52 ms - 137

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