Date Picker in iOS



import java.net.MalformedURLException;
import java.net.URL;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Date_Picker_ios {

public static void main(String[] args) throws MalformedURLException, InterruptedException {
// TODO Auto-generated method stub

DesiredCapabilities capabilities= new DesiredCapabilities();

capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Iphone");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "ios");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.3.5");
capabilities.setCapability("udid", "499ae5ae6d066971991c5d27e8fbff07899a489d");


capabilities.setCapability("bundleId", "com.example.apple-samplecode.UICatalog");

AppiumDriver driver= new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

Thread.sleep(8000);
//**********************************************
driver.findElementByXPath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/"
+ "UIATableCell[5]/UIAStaticText[1]").click();
Thread.sleep(4000);

driver.findElementByXPath("//UIAApplication[1]/UIAWindow[1]"
+ "/UIAPicker[1]/UIAPickerWheel[1]").sendKeys("Tue 29 Nov");

driver.findElementByXPath("//UIAApplication[1]/UIAWindow[1]"
+ "/UIAPicker[1]/UIAPickerWheel[2]").sendKeys("9");

driver.findElementByXPath("//UIAApplication[1]/UIAWindow[1]"
+ "/UIAPicker[1]/UIAPickerWheel[3]").sendKeys("10");

driver.findElementByXPath("//UIAApplication[1]/UIAWindow[1]"
+ "/UIAPicker[1]/UIAPickerWheel[4]").sendKeys("AM");

Thread.sleep(4000);

String Actual_Result = driver.findElementByXPath("//UIAApplication[1]/UIAWindow[1]"
+ "/UIAStaticText[1]").getText();

System.out.println(Actual_Result);








}

}

No comments:

Post a Comment

Copyright © 2017 QALEARNINGGUIDE.COM || ALL RIGHTS RESERVED