Selenium With Java and Python For Mobile Apps & Web Apps......!

Thursday, 2 June 2016

How to Automate ios Application using Appium.

package com.flipkart;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

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

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;

public class IosE2e {

public static void main(String args[]) throws MalformedURLException, InterruptedException {
DesiredCapabilities cap=new DesiredCapabilities();
IOSDriver dr;
String appPath = "Users/pardeep.k//Documents//Flipkart.app";
File f = new File("//Users//pardeep.k//Documents//", "Flipkart.app");
cap.setCapability("deviceName", "iPhone 5s");
cap.setCapability("PlatformVersion", "8.1");
cap.setCapability("PlatformName", "iOS");
cap.setCapability("app", f);
dr=new IOSDriver(new  URL("http://127.0.0.1:4723/wd/hub"), cap);
Thread.sleep(7000);
dr.findElement(By.name("Log in")).click();
Thread.sleep(5000);
dr.findElement(By.name("emailTextField")).sendKeys("*********");
dr.findElement(By.name("passwordTextField")).sendKeys("**********");
dr.findElement(By.name("Log in")).click();

//dr.findElement(By.name("mobileTextField")).sendKeys("*********");
Thread.sleep(5000);

}

}

0 comments:

Post a Comment

Translate

Popular Posts

Total Pageviews