Hiding keyboard inward android device is 1 of the mutual action. In your android mobile device, It volition exhibit y'all soft keyboard on cover automatically when y'all type text inward text box of software app therefore it volition shroud around of the elements. Now supposing y'all wants to lead value from drib downward which is hidden behind android keyboard. For that, You withdraw to hide android keyboard showtime therefore that y'all tin come across drib downward in addition to and therefore y'all tin lead value from it. In android appium software automation test, It is real slow to hide android keyboard using hideKeyboard() method of AndroidDriver. Let's acquire how to hide android keyboard inward appium software automation test.
App To Use And Aim Of Test
We volition role same API Demos software app In this keyboard hiding test. Main aim of this appium software automation examination is to shroud android soft keyboard afterwards typing text inward text box every bit shown inward bellow image.
Manually y'all tin sentiment inward a higher house cover inward API Demos software app from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.
Create And Run Test
Create bellow given Keyboard hiding appium examination eclipse.
SelectDropDownValue.java
package Android; import io.appium.java_client.android.AndroidDriver; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; populace flat SelectDropDownValue { AndroidDriver driver; @BeforeTest populace void setUp() throws Exception { DesiredCapabilities capabilities = novel DesiredCapabilities(); capabilities.setCapability("deviceName", "ZX1B32FFXF"); capabilities.setCapability("browserName", "Android"); capabilities.setCapability("platformVersion", "4.4.2"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("appPackage", "io.appium.android.apis"); capabilities.setCapability("appActivity","io.appium.android.apis.ApiDemos"); driver = novel AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); } @Test populace void select() throws InterruptedException { // Scroll till chemical part which contains "Views" text If It Is non visible on screen. driver.scrollTo("Views"); // Click on Views. driver.findElement(By.name("Views")).click(); // Scroll till chemical part which contains "Controls" text If It Is non visible on screen. driver.scrollTo("Controls"); // Click on Controls. driver.findElement(By.name("Controls")).click(); // Scroll till chemical part which contains "2. Dark Theme" text If It Is non visible on screen. driver.scrollTo("2. Dark Theme"); // Click on 2. Dark Theme. driver.findElement(By.name("2. Dark Theme")).click(); // Typing inward text box using sendKeys command. driver.findElement(By.id("io.appium.android.apis:id/edit")).sendKeys("Test"); //To shroud keyboard. driver.hideKeyboard(); } @AfterTest populace void End() { driver.quit(); } }
Run inward a higher house examination inward eclipse using testng in addition to appium. Last syntax of @Test method volition shroud android keyboard.
This agency y'all tin shroud keyboard of android device inward appium android software automation testing.