appium / appium/java-client

InvalidElementStateException on SecureTextField is not ready for a text input on iOS/XCUITest

Open
#1,386 12 comments 1 reaction 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

Just recently unable to enter text into a XCUIElementTypeSecureTextField on iOS as I consistently get InvalidElementStateException: Error Domain=com.facebook.WebDriverAgent Code=1 "'"passwordTextField" SecureTextField' is not ready for a text input. Neither the accessibility element itself nor its accessible descendants have the input focus

I have already tried different identifiers such as xpath vs className, name, everything.
I have already tried setting hardware keyboard to true and/or false.
I have already tried setting different sendKeyStrategy options.
I have already tried getKeyboard() before and after interacting with the field.

This is a sudden break on very old regression tests, without changes to source test code or source app code for context.

Steps:

  1. Define element any way possible. (Have tried by className = "XCUIElementTypeSecureTextField", name= "specificID", xpath = "//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeSecureTextField" and combination of driver find bys to no avail)
  2. sendKeys into the SecureTextField. Also have tried many ways including clearing, clicking into the field, directly sending keys from keyboard- to no avail.
  3. All interactions with the field produce the InvalidElementStateException

Environment

``

  • Java client build version or git revision if you use some snapshot: 7.3.0
  • Appium server version or git revision if you use some snapshot: 1.18.1
  • Desktop OS/version used to run Appium if necessary: App Version: 1.18.0 Electron: 7.2.4
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: Node.js: 12.8.1
  • Mobile platform/version under test: iOS 12.4+ (occurring also on 13.1, 13.4, 13.6)
  • Real device or emulator/simulator: Simulator

Details

Please provide more details, if necessary.

Code To Reproduce Issue [ Good To Have ]

@FindBy(name = "passwordTextField") private WebElement passwordTextField;
public void enterFirstPassword(String password){ ((IOSDriver)driver).getKeyboard(); passwordTextField.clear(); passwordTextField.sendKeys(password); ((IOSDriver)driver).hideKeyboard(HideKeyboardStrategy.PRESS_KEY,"next"); }

Exception Stacktraces

org.openqa.selenium.InvalidElementStateException: Error Domain=com.facebook.WebDriverAgent Code=1 "'"passwordTextField" SecureTextField' is not ready for a text input. Neither the accessibility element itself nor its accessible descendants have the input focus" UserInfo={NSLocalizedDescription='"passwordTextField" SecureTextField' is not ready for a text input. Neither the accessibility element itself nor its accessible descendants have the input focus}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MVADMINs-MacBook-Pro-2.local', ip: 'fe80:0:0:0:14cc:83e1:88d:25cd%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.6', java.version: '11.0.7'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {app: src/main/resources/app/ios/..., autoAcceptAlerts: false, autoDismissAlerts: false, automationName: XCUITest, browserName: , clearSystemFiles: true, connectHardwareKeyboard: false, databaseEnabled: false, deviceName: iPhone 7, ensureFreshSimulatorCreation: true, fullReset: true, isHeadless: false, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 15, platform: MAC, platformName: iOS, platformVersion: 13.1, sendKeyStrategy: oneByOne, shouldUseSingletonTestManager: false, takesScreenshot: true, udid: 64D22ED2-2DA1-47AB-9CE1-4E7..., webStorageEnabled: false}
Session ID: 06a2e55d-4037-4cdc-8510-32df5e421555

	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
	at io.appium.java_client.DefaultGenericMobileElement.execute(DefaultGenericMobileElement.java:45)
	at io.appium.java_client.MobileElement.execute(MobileElement.java:1)
	at io.appium.java_client.ios.IOSElement.execute(IOSElement.java:1)
	at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:106)

Link To Appium Logs

https://gist.github.com/alyshakt/365996aac3dd47ee38feded21c512070

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 SecureTextField sendKeys failure using the Java client 7.3.0, Appium 1.18.1, and the simulator versions listed in the issue, then review the linked Appium logs. Compare the element interaction and keyboard behavior described in the reproduction steps; done means text can be entered without InvalidElementStateException.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.