Hiding keyboard inward android device is ane of the mutual action. In your android mobile device, It volition exhibit you lot soft keyboard on covert automatically when you lot type text inward text box of software app therefore it volition enshroud only about of the elements. Now supposing you lot wants to pick out value from driblet downward which is hidden behind android keyboard. For that, You quest to hide android keyboard outset therefore that you lot tin meet driblet downward in addition to and therefore you lot tin pick out value from it. In android appium software automation test, It is rattling slow to hide android keyboard using hideKeyboard() method of AndroidDriver. Let's larn how to hide android keyboard inward appium software automation test.
App To Use And Aim Of Test
We volition purpose same API Demos software app In this keyboard hiding test. Main aim of this appium software automation exam is to enshroud android soft keyboard subsequently typing text inward text box every bit shown inward bellow image.
Manually you lot tin persuasion higher upwards covert 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 exam 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; world course of didactics SelectDropDownValue { AndroidDriver driver; @BeforeTest world 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 world void select() throws InterruptedException { // Scroll till chemical component 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 component 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 component 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 enshroud keyboard. driver.hideKeyboard(); } @AfterTest world void End() { driver.quit(); } }
Run higher upwards exam inward eclipse using testng in addition to appium. Last syntax of @Test method volition enshroud android keyboard.
This agency you lot tin enshroud keyboard of android device inward appium android software automation testing.