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.

getText() or getAttribute('value') returns empty string for iOS platform

See original GitHub issue

The problem

Unable to use getText() or getAttribute('value') they return nothing in automated tests for iOS platform

Environment

  • Appium version (or git revision) that exhibits the issue: 1.15.0
  • Last Appium version that did not exhibit the issue (if applicable): 1.14.1 (with older Xcode)
  • Desktop OS/version used to run Appium: macOS 10.14.6
  • Node.js version (unless using Appium.app|exe): 10.16.3
  • Npm or Yarn package manager: Yarn
  • Mobile platform/version under test: iOS 12.2
  • Real device or emulator/simulator: iPhone X Simulator
  • Appium CLI or Appium.app|exe: CLI

Details

getText() and getAttribute('value') both successfully execute but return nothing, even though text is present in element. Pretty surprised this was not caught during testing but as I look at it it may have to do with Xcode version or a change in XCUITest cause it still doesn’t work when downgrading Appium. Going to try to revert to an older version of Xcode to see if this helps the issue. I don’t see any issues open in appium-xcuitest-driver for this either.

Link to Appium logs

To be added if needed.

Code To Reproduce Issue [ Good To Have ]

To be added if needed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nilenthcommented, Feb 9, 2021

@sebinjqburst @mykola-mokhnach Are there any new updates for this issue or are you guys still using the same workaround? I’m currently testing an app in iOS 14.3 with Xcode 12.3 and came across the same issue.

1reaction
lubshilkcommented, Nov 14, 2019

With newest Xcode 11.2.1 the same problems Is there some WA?

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS: getAttribute("value") works for some elements, returns ...
getAttribute (“value”), I get an empty String. However, I use getAttribute(“value”) elsewhere in the code and it works as expected. Examples:.
Read more >
WebElement..getText() sometimes returns empty string when ...
I am finding that WebElement.getText() returns an empty string sometimes, but when it happens and I take a screenshot, the text is there....
Read more >
Why GetText method returns empty string - java - Stack Overflow
Regarding your application you may need to use getAttribute("value") instead of getText() as getText return the inner text.
Read more >
How To Get Text Of An Element In Selenium? - LambdaTest
On running the above code, you will see results in the console with a print statement showing an empty string returned by the...
Read more >
getAttribute() method in Selenium: What, Why, and How to use
The getAttribute() method is declared in the WebElement interface, and it returns the value of the web element's attribute as a string.
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