How can we launch safari in real devices say I have iPod 5 (OS version 8.0.2). I have written the code like below:
package com.mob.safari;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
public class SafariLaunch {
AppiumDriver driver;
@Test
public void Launch() {
// driver.get("http://google.com");
}
@BeforeTest
public void beforeTest() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("deviceName", "iPod 5");
capabilities.setCapability(CapabilityType.VERSION, "8.0.2");
capabilities.setCapability("udid", "af5020497b55d10f41a88c488051a85927765a08");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "safari");
URL url = new URL("http", "0.0.0.0", 4723, "/wd/hub");
driver = new AppiumDriver<WebElement>(url, capabilities) {
@Override
public MobileElement scrollToExact(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public MobileElement scrollTo(String arg0) {
// TODO Auto-generated method stub
return null;
}
};
driver.get("https://www.google.com/");
}
@AfterTest
public void afterTest() {
}
}
Following are the errors I am getting when run the code.
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: ENOENT: no such file or directory, stat '/usr/local/lib/node_modules/appium/build/SafariLauncher/SafariLauncher.zip') (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 674 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'Sanojs-Mac-mini.local', ip: '172.16.2.243', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11', java.version: '1.8.0_60'
Driver info: com.mob.safari.SafariLaunch$1
My system spec:
MAC OS: 10.11
Xcode: 7.0
Please help me to run the safari in real devices. Because next we are starting the mobile web automation using appium.