Appium Tutorial - Type In Text Box Of Android App

Text box is rattling mutual chemical gene of whatsoever android native software app or software spider web application. In android appium software automation test, If yous wants to type text inwards text box of android app therefore yous tin purpose sendKeys(keysToSend) ascendance of selenium WebElement interface. Let's hold off at event to larn how to type inwards text box of android app.

App To Use And Aim Of Test
We volition purpose API Demos software app inwards this examination to larn how to type inwards textbox of android application. 

appium - type inwards text box of android app

Above hide display text box. We volition purpose this text box to type text inwards android appium software test. You tin navigate to inwards a higher house hide from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.

Create too last software test
Create bellow given examination inwards eclipse too last it using testng too appium too detect examination execution inwards your android mobile screen.

TypeInTextBox.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 bird TypeInTextBox {  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 typeInText() throws InterruptedException {   // Scroll till chemical gene 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 gene 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 gene 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 inwards text box using sendKeys command.   driver.findElement(By.id("io.appium.android.apis:id/edit")).sendKeys("Test");  }   @AfterTest  world void End() {   driver.quit();  } }

Last controversy of text method volition type text "Test" inwards textbox of API Demos android app.

This agency yous tin use sendKeys(keysToSend) ascendance to type text inwards whatsoever text box of android software  application.

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post