appium / appium/java-client

Can only retrieve text when searching for XPath on Appium iOS 12.4

Open
#1,376 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

I'm trying to retrieve the text from an element on a iOS 12.4 app, using Java Client (v7.3.0) for Appium (v1.17.1), and iOS simulator.

When I search for the element using an ID, the retrieved text is empty, but when I search for the exact same element using a xPath, it retrieves the text as expected.

Driver.getDriver().findElement(By.name("foobar")).getText() = ""
Driver.getDriver().findElement(MobileBy.AccessibilityId("foobar")).getText() = ""

Driver.getDriver().findElement(By.xpath("//XCUIElementTypeTextField[@name=\"foobar\"]")).getText() = "expectedText"

When I retrieve the hash ID of the element using the previous methods, the ID is exactly the same, so it's the same element that is been found. The logs confirm this; they are the same for the different approaches, with the expected differences on the args of the request and the text's returned value.

Also, I don't have this issue on iOS 13.4.

Has anyone came across this scenario and know why it's happening?

Environment

  • Java client 7.3.0
  • Appium 1.17.1
  • iOS 12.4
  • simulators: iPhone 8 Plus, iPhone X

Link To Appium Logs

https://gist.github.com/nacfe/f85e049bbe608983313f85c01cbd2623

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 issue with Java client 7.3.0, Appium 1.17.1, and an iOS 12.4 simulator, then compare the ID, AccessibilityId, and XPath requests and responses in the linked Appium logs. Investigate why text differs for the same element on iOS 12.4, compare the behavior with iOS 13.4, and consider the issue done when the affected lookup methods return the expected text.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, java
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.