1

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

Appium Inspector Screenshot

Page Source Snippet:

                            </XCUIElementTypeStaticText>
                          </XCUIElementTypeOther>
                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="16" y="159" width="343" height="75">
                            **<XCUIElementTypeTextField type="XCUIElementTypeTextField" enabled="true" visible="true" x="16" y="161" width="343" height="53" label="" value="">
                            </XCUIElementTypeTextField>**
                            <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="28" y="159" width="50" height="30" name="Username" label="Username">
                              <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" enabled="true" visible="true" x="28" y="167" width="50" height="14" name="Username" label="Username" value="Username">
                              </XCUIElementTypeStaticText>
                            </XCUIElementTypeOther>
                          </XCUIElementTypeOther>
                          <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="16" y="232" width="343" height="75">
                            <XCUIElementTypeSecureTextField type="XCUIElementTypeSecureTextField" enabled="true" visible="true" x="16" y="234" width="343" height="53" label="" value=" ">
                            </XCUIElementTypeSecureTextField>
                            <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="28" y="232" width="49" height="30" name="Password" label="Password">
                              <XCUIElementTypeStaticText type="XCUIElementTypeStaticText" enabled="true" visible="true" x="28" y="240" width="49" height="14" name="Password" label="Password" value="Password">
Dev
  • 11
  • 3

1 Answers1

1

I experienced a similar issue. iOS 13 adds surplus XCUIElementTypeOther elements which change the path compared to iOS 12.

To solve this for my use case, I added a unique identifier to elements for direct access (quicker lookups), and in the case where a unique identifier wasn't possible (e.g. WebView) I changed the selector to rely on first match.

e.g. under Appium 1.17.0:

//XCUIElementTypeTextField[@name="foo"] for direct lookup to a single item.

//XCUIElementTypeWebView for a find all multi match.

Assuming there is only one WebView on the screen, on iOS 12 that generic lookup yields a single item, where as on iOS 13 it yields 3 (nested within each other). Thankfully capabilities.useFirstMatch resolves it back to one.

ReDrUmNZ
  • 51
  • 3
  • the approach `//XCUIElementTypeTextField` was the one that worked for me using iOS 14 and xcode 12.5+ combination – Jonatas CD Sep 09 '21 at 08:34