友 试图在ios实际设备上运行appium脚本,得到以下错误
Eclipse错误:
[TestNG]正在运行:
/private/var/folders/05/79kfthm94qjd3bngd2l5pv7r0mx69v/T/testng-eclipse--1690789728/testng-customsuite.xml
FAILED CONFIGURATION:@BeforeClass setUpBeforeClass
org.openqa.selenium.SessionNotCreatedException:新会话可以 不被创造。 (原始错误:命令失败:/ bin / sh -c xcrun --sdk iphonesimulator --show-sdk-version)(警告:服务器没有提供任何堆栈跟踪信息)
命令持续时间或超时:15.00秒
构建信息:版本:' 2.51.0',修订版:' 1af067d',时间: ' 2016-02-05 19:15:17'
系统信息:主持人:' 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'
驱动程序信息:org.openqa.selenium.remote.RemoteWebDriver
和.java代码:
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");
}
}
答案 0 :(得分:1)
您可以尝试,因为根据快速谷歌搜索,这可能与libxml库有关。
$ brew uninstall libxml2
$ brew prune
$ brew install libxml2
您还应该尝试更新Xcode命令行工具。因为它在尝试使用xcrun命令时失败了。
答案 1 :(得分:1)
似乎错误的能力
capabilities.setCapability( “u_did”, “840384833537f40d011032eaaf20a53705a451ce”);
尝试使用“udid”键而不是“u_did”
答案 2 :(得分:0)
尝试从https://developer.apple.com/download/more/安装命令行工具 这解决了我的错误---- xcode 10.1