Tuesday, September 4, 2018

Appium - Choose Especial From Driblet Downwards Of Android App

| Tuesday, September 4, 2018
Selecting item/value from drib downward is needed inward android software app equally nearly of the apps comprise drib down. Earlier nosotros learnt how to choose value from spinner inward android appium software exam which is opening inward straight listing inward THIS POST. Now let's meet about other event of how to choose value from drib downward listing which is opening inward popup.

App To Use And Aim Of Test
We volition role API Demos software app inward this drib downward exceptional pick test. Our brain aim is to click on drib downward to opened upwards items listing popup as well as and thence selecting 1 exceptional from listing equally shown inward bellow image.

value from drib downward is needed inward android software app equally nearly of the apps comprise drib create Appium - Select Item From Drop Down Of Android App

You tin persuasion higher upwards covert from API Demos software app's Home -> Views -> Controls -> 2. Dark Theme. -> Tap on Drop Down.

Create And Run Test
I accept created real uncomplicated appium android drib downward exceptional pick software automation test. Create bellow given exam inward eclipse.

SelectValueDropDown.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 class SelectValueDropDown {  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 ingredient 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 ingredient 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 ingredient 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();   //Click on dropdown to opened upwards list.   driver.findElement(By.id("android:id/text1")).click();   //Select exceptional "Mars" from drib downward list.   driver.findElement(By.name("Mars")).click();     }   @AfterTest  world void End() {   driver.quit();  } }

Run higher upwards exam inward eclipse using appium as well as testng as well as notice exam execution. Last syntax volition choose exceptional "Mars" from listing items.

This agency you lot tin choose value from android software app's drib downward listing inward appium test.

Related Posts