Suhail Ahmed
Suhail Ahmed

Reputation: 554

Original error: Error Domain=com.facebook.WebDriverAgent Code=1 "Keyboard is not present" UserInfo={NSLocalizedDescription=Keyboard is not present}

My simulator keyboard is not displayed when I run my test cases from automation. I keep getting the below error.

Original error: Error Domain=com.facebook.WebDriverAgent Code=1 "Keyboard is not present" UserInfo={NSLocalizedDescription=Keyboard is not present}

When my automation code opens simulator, In simulator->Harward->keyboard->Connect Hardware keyboard is unchecked and I am not able to check that.

And when I open simulator normally I get the simulator keyboard and the option Connect hardware Keyboard is also selected by default

Can anyone help me out here.

Upvotes: 2

Views: 5550

Answers (4)

NITIN SURANGE
NITIN SURANGE

Reputation: 524

error occurs when you use ios simulator.

To solve this use below command for enabling keyboard.

1.Restart your Xcode if it's already open. Then use below keys.

For opening and closing keyboard you can use below shortcuts.

cmd + k

If first option doesn't work then set below capabilities in your script.

2. DesiredCapabilities capabilities = new DesiredCapabilities();

  capabilities.setCapability("Connect Hardware Keyboard", true);

    OR

(capabilities.setCapability(IOSMobileCapabilityType.CONNECT_HARDWARE_KEYBOARD, true)

Upvotes: 2

iOS:Real Device

  1. Uninstall if you have installed any third party keyboards, keep only the default keyboard on the device.
  2. Re run the same code. It should work now
  3. Uninstalling Keyboards: Settings ->General -> KeyBoards-> Edit

Upvotes: 1

VSB
VSB

Reputation: 327

I resolved this on iOS for Mobile app automation using Appium

  1. Set the capability to not refer to the hardware keyboard

cap.setCapability("connectHardwareKeyboard", false);

  1. While executing the case, where you need to access the keyboard use

driver.findElementByXPath("****** ").sendKeys("Text")

  1. After getting the input on the field, dismiss the keyboard

driver.hideKeyboard()

Upvotes: 1

dmle
dmle

Reputation: 3658

Its a known WebDriverAgent issue: https://github.com/facebook/WebDriverAgent/issues/574

Try to update to latest Appium server 1.9.1 to use latest version of WebDriverAgent.

If it won't help, follow suggestion from the last comment on github issue:

Before tests run bash script defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool no

Add turn off hardware keyboard as it seems to cause failures occasionally

Upvotes: 2

Related Questions