appium / appium/java-client

Cannot get list of Elements with Page Factory

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

Nobody has claimed this yet.

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

Description

Description

@iOSXCUITFindBy(locator) List returns null, while driver.findElements(locator) return list

Environment

  • Java client build version or git revision if you use some snapshot: 7.20
  • Appium server version or git revision if you use some snapshot: 1.15.1
  • Desktop OS/version used to run Appium if necessary: MacOS
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 12.10.0
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: Real device iOS 11-13

Details

Screenshot 2019-11-22 at 11 34 03

Code To Reproduce Issue [ Good To Have ]

//retun null
@iOSXCUITFindBy(className = "XCUIElementTypeCell")
var ordersList: List< MobileElement>? = null

init {
    PageFactory.initElements(AppiumFieldDecorator(driver), this)
}

//return list with 2 elements
fun orders(): List? {
return driver!!.findElements(MobileBy.className("XCUIElementTypeCell"))
}

Exception Stacktraces

Link To Appium Logs

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

Start by reproducing the annotated List case with AppiumFieldDecorator and compare it with driver.findElements using the listed Java client, Appium, and iOS versions. Trace PageFactory.initElements and the @iOSXCUITFindBy handling; done means the annotated list is populated consistently with the direct element lookup.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.