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!