IOS: Element.getAttribute("value") always returns " " for iOS 13 & Above

Issue: For “XCUIElementTypeTextField” element (On iOS 13 & Above), The value is displayed as “OBJ” in the Appium Inspector and programmatically when I tried to Element.GetAttribute(“value”) I get " ". Please see attached screenshot and Page Source

I tried to get the page source and even the page source does not contain the value for “XCUIElementTypeTextField”.

But when I tried on a device with 12.4.1 OS, it works perfectly fine and displays the value in the inspector as well as page source.

I am wondering if anyone is facing the same issue ?

Configuration:

  • Appium version (or git revision) that exhibits the issue: 1.17.0
  • Desktop OS/version used to run Appium: macOS Catalina, 10.15.4
  • Npm or Yarn package manager:
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: Real Device (iPhone X 13.4.1)
  • Java Client: 7.3.0
  • Xcode: 11.4
  • Device OS: 13.4.1

PageSource13.4.txt (23.9 KB)

it is normal case for secure fields. nothing you can do.
you can try to see it value in webView. Switch context to WebView and check value. You may try first with Safari debugger ( https://medium.com/@mattcroak718/debugging-your-iphone-mobile-web-app-using-safari-development-tools-71240657c487 ).

@Aleksei Just curious, the element I am trying to get value is not a secure field. If you notice the tree structure, it says “XCUITElementTypeTextField” as supposed to “XCUIElementTypeSecureTextField”.

Maybe. I met same with some service login also.

Once again: check same login screen in browser.

@Dev_P, There is compatability issue with Xcode 11.4 version and with iOS (12.xx versions). Even i faced this issue and upgraded my iOS version from 12.xx to 13.xx . Then it worked for me. If you want to work with iOS 12.xx then you have to use old Xcode Version 10.xx and where the OS should supports xcode 10.xx verison.

If dont want to upgrade iOS Verison or downgrade Xcode versions. Please use the x,y cordinates to click the text field…

1 Like

Hi Aleksei,
I am using Microsoft Appcenter test cloud to run automation. Unfortunately, Appcenter does not support webview context.

Hi, I am using Xcode 11.4 with iOS 13.4.1 and I am still facing the issue.
Which version of iOS is working for you with Xcode 11.4 ?

Same combination 11.4 Xcode with 13.4.1 iOS, works fine for me.

If you couldn’t get value , Did you gave a try with x & y coordinates ?

it does not depend on cloud you use. it is only depends on app you test.

Hi @Aleksei,
That was my assumption earlier but appcenter logs were showing failure when I tried switching to webview. I reached out to appcenter and they confirmed they do not support webview. Please find attached screenshot from appcenter docs (https://docs.microsoft.com/en-us/appcenter/test-cloud/appium/preparing-for-upload)

Hi @pothurajtharun,
Interesting! so here is what I observed. If the text field has a label like “Username” or a watermark, it does not return any value. If it is a plain text field without a field label or watermark, it returns the value.

Since the page source did not have any value for text field, I assumed coordinates may not do the trick but let me give it a try. I will report back

@Dev_P aaaaa! Maybe they did not enabled with Apple devices webView debug.