Keyboard is not present

Hi there,

We are trying to execute desktop web tests on mobile web browsers(we use saucelabs/browserstack to execute tests on real devices). When tried to use the below method throws keyboard is not present but works fine for Android. On Android when trying to enter text using send keys keyboard comes up but not in iOS.

((RemoteWebDriver) driver).getKeyboard().sendKeys(Keys.RETURN);

Below is the code snippet

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(“device”, “iPhone 8”);
caps.setCapability(“realMobile”, “true”);
caps.setCapability(“os_version”, “11.0”);
caps.setCapability(“browserstack.debug”, “true”);
caps.setCapability(“autoWebview”, “true”);
caps.setCapability(“connectHardwareKeyboard”, “true”);

driver.findElement(By.cssSelector(".btn.btn–block.js-responsiveBtnWt.btn–block–flatstyle.qa-Cl_order")).click();
driver.get(“https://website”);
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);

driver.findElement(By.xpath("//div[@id=‘locationsSearchPage’]/form/div/div/div[2]/div/div/label/span")).click();
driver.findElement(By.id(“cityFinder”)).clear();
driver.findElement(By.id(“cityFinder”)).sendKeys("Taylor, MI ");
((RemoteWebDriver) driver).getKeyboard().sendKeys(Keys.RETURN);
driver.quit();

Error:

Exception in thread “main” org.openqa.selenium.WebDriverException: Appium error: An unknown server-side error occurred while processing the command. Original error: Error Domain=com.facebook.WebDriverAgent Code=1 “Keyboard is not present” UserInfo={NSLocalizedDescription=Keyboard is not present} (WARNING: The server did not provide any stacktrace information)

Any help you can provide would be greatly appreciated. Thanks in Advance!

I get the same when I do a POST to keys

=> {“message”:“An unknown server-side error occurred while processing the command. Original error: Error Domain=com.facebook.WebDriverAgent Code=1 “Keyboard is not present” UserInfo={NSLocalizedDescription=Keyboard is not present}”}

I’m using SauceLabs, with appium 1.7.1, iOS 11.0 simulator.

Disable "Connect Hardware Keyboard’ option in your simulator, this might resolve the issue.

Steps in this video: