Appium - Select Item From Drop Down Of Android App

Selecting item/value from drib downwards is needed inward android software app every bit virtually 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 run across or therefore other representative of how to choose value from drib downwards listing which is opening inward popup.

App To Use And Aim Of Test
We volition piece of job API Demos software app inward this drib downwards exceptional choice test. Our master copy aim is to click on drib downwards to opened upwards items listing popup as well as therefore selecting 1 exceptional from listing every bit shown inward bellow image.

appium choose value from drib downwards list

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

Create And Run Test
I accept created really elementary appium android drib downwards exceptional choice 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 enshroud keyboard    driver.hideKeyboard();   //Click on dropdown to opened upwards list.   driver.findElement(By.id("android:id/text1")).click();   //Select exceptional "Mars" from drib downwards list.   driver.findElement(By.name("Mars")).click();     }   @AfterTest  world void End() {   driver.quit();  } }

Run to a higher house 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 means you lot tin choose value from android software app's drib downwards listing inward appium 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