简体   繁体   中英

Appium on ios actual device gives sdk iphone simulator error

Friends, Trying to run appium script on ios actual device,gets below error

Eclipse error:

[TestNG] Running:

/private/var/folders/05/79kfthm94qjd3bngd2l5pv7r0mx69v/T/testng-eclipse--1690789728/testng-customsuite.xml

FAILED CONFIGURATION: @BeforeClass setUpBeforeClass

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 15.00 seconds

Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17'

System info: host: 'NCA047065', ip: '10.65.210.61', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.7.0_79'

Driver info: org.openqa.selenium.remote.RemoteWebDriver

And .java code:

import org.junit.BeforeClass;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;
import java.io.File;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class iOSApptest {

public static RemoteWebDriver driver;


@BeforeClass
public static void setUpBeforeClass() throws Exception
{ 
    File appDir = new File ("//Users//gangaiahl//Appium//jars");
    File app = new File (appDir, "Car.ipa");

    DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability(CapabilityType.BROWSER_NAME, "firefox");
    capabilities.setCapability("device", "iPhone 6");
    capabilities.setCapability("u_did", "840384833537f40d011032eaaf20a53705a451ce");
    capabilities.setCapability("bundle_id", "au.dev.com.onewaytraffic.carsguide");
    capabilities.setCapability("deviceName", "Cars_iPhone_6");
    capabilities.setCapability("platformName", "iOS");
    capabilities.setCapability("platformVersion", "9.2"); 
    capabilities.setCapability("app",app.getAbsolutePath());

    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

}

@Test
public void test()
{
    System.out.println("Test started");
    //System.out.println(" Start to identify a test");
    //System.out.println("Test Completed");
}

}

You can try since that could have to do with the libxml library according to a quick google search.

$ brew uninstall libxml2
$ brew prune
$ brew install libxml2

You should also try and update your Xcode command line tools. Since its failing when trying to use the xcrun command.

It seems wrong capability

capabilities.setCapability("u_did", "840384833537f40d011032eaaf20a53705a451ce");

Try use "udid" key instead of "u_did"

See documentation

Xcode 11

Try installing command-line tools from https://developer.apple.com/download/more/ This solved my error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM