question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
VitaliiPopovElekscommented, Jan 19, 2022

I have a similar issue. When am trying to findElements() I get this error: An unknown server-side error occurred while processing the command. Original error: java.lang.ClassCastException: java.util.ArrayList$ListItr cannot be cast to org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType

Read more comments on GitHub >

github_iconTop Results From Across the Web

deprecated list - java-client 8.0.0-beta javadoc
io.appium; java-client. java-client. 8.0.0-beta. 8.3.0 8.2.1 8.2.0 8.1.1 8.1.0 8.0.0 8.0.0-beta2 8.0.0-beta 7.6.0 7.5.1 7.5.0 7.4.1 7.4.0 7.3.0 7.2.0 7.1.0 ...
Read more >
MobileElement not exist in java-client 8.0.0 - Stack Overflow
I can't find a way to import MobileElement for code I copy after following this guide: https://www.youtube.com/watch?v=i1tQ1pjEFWw&t= ...
Read more >
What's New in Appium Java Client 8.0.0 - Applitools
Most of the Appium clients are updated and now in early beta, but with a lot of breaking changes. Let's go through the...
Read more >
Improve code inspection with annotations - Android Developers
Learn how annotations allow you to provide hints to code inspections tools like Lint, to help detect these more subtle code problems.
Read more >
Retrofit - Square Open Source
A type-safe HTTP client for Android and Java. ... Annotations on the interface methods and its parameters indicate how a request will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found