Appium : Select Check-box Of Android App

Check box is only about other mutual chemical share of whatsoever native, hybrid or mobile software spider web applications. Selecting depository fiscal establishment tally box of android software app inwards appium examination is real slow chore in addition to I hope, most of you lot already knows how to select android app's depository fiscal establishment tally box inwards appium automation examination but i direct maintain to mean value nearly bottom score learner who don't know how to select android app's check box inwards appium automation software test. Let's accept real uncomplicated event to larn how to choose depository fiscal establishment tally box inwards appium. We tin laissez passer the sack live click() method to choose depository fiscal establishment tally box.
Do you lot wants to larn all appium tutorials? View this LINK.

App To Use And Aim To Achieve In Software Test 
We volition live same API Demos software app of android to larn how to choose depository fiscal establishment tally box of android app every bit shown inwards bellow image.

appium automation - choose checkbox

Manually you lot tin laissez passer the sack navigate to to a higher house covert from API Demos app's Home -> Views -> Controls -> 2. Dark Theme.

Create And Run Test
Create bellow given examination inwards eclipse in addition to run it using testng in addition to appium. Observe examination execution inwards android device.

SelectingCheckBox.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 shape SelectingCheckBox {  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 share 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 share 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 share 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();   // Click on check-box to choose it.   driver.findElement(By.name("Checkbox 2")).click();  }   @AfterTest  populace void End() {   driver.quit();  } }

Last syntax in @Test method volition choose the depository fiscal establishment tally box using .click() method when you lot run software test.

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