getText() or getAttribute('value') returns empty string for iOS platform
See original GitHub issueThe 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:
- Created 4 years ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
With newest Xcode 11.2.1 the same problems Is there some WA?