Test picker view using appium for IOS - Java Testing

Java examples for Testing:Appium

Description

Test picker view using appium for IOS

Demo Code


import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.ios.IOSDriver;

public class IOSPickers {
    public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("automationName", "Appium");
        capabilities.setCapability("platformName", "iOS");
        //    capabilities.setCapability("platformVersion", "9.2.1");
        //    capabilities.setCapability("deviceName", "iPhone"); //

        capabilities.setCapability("platformVersion", "9.1");
        capabilities.setCapability("deviceName",
                "Augusta?s iPhone6S plus"); //
        capabilities//  w ww.ja  va 2  s  .  com
                .setCapability(
                        "app",
                        "/Users/administrator/Library/Developer/Xcode/DerivedData/UICatalog-etygmeejalybcbeaczwvsdflvftm/Build/Products/Debug-iphoneos/UICatalog.app");
        capabilities.setCapability("bundleId", "com.augusta.test"); //bundleId
        capabilities.setCapability("udid",
                "test id");
        IOSDriver driver = new IOSDriver(new URL(
                "http://0.0.0.0:4723/wd/hub"), capabilities);
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver.scrollTo("Picker View").click();
        ((WebElement) driver.findElements(By.className("UIAPickerWheel"))
                .get(1)).sendKeys("150");

        //System.out.println(slider.getAttribute("value"));

        driver.quit();
    }
}

Related Tutorials