Appium错误:无法获得Xcode版本

时间:2015-09-22 18:47:55

标签: xcode testing mobile automation appium

尝试在eclipse上启动测试时出现Appium错误。 我已经安装了Xcode 6.4,它应该可以工作,但它没有。

error: Could not determine Xcode version:Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.

info: [debug] Setting iOS SDK Version
info: [debug] Cleaning up appium session
info: [debug] Error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.
    at getVersionWithoutRetry$ (lib/xcode.js:115:11)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:294:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at bound (domain.js:254:14)
    at GeneratorFunctionPrototype.runBound (domain.js:267:12)
    at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:89:39)
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:100:28
    at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.)","origValue":"Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk."},"sessionId":null}
info: <-- POST /wd/hub/session 500 470.776 ms - 286 

error: Could not determine iOS SDK version
error: Failed to start an Appium session, err was: Error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.

Eclipse代码

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

import org.openqa.selenium.remote.DesiredCapabilities;

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

public class Uicatalog {
    public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities cap=new DesiredCapabilities();
        File f=new File("/Users/afiliptsov/Application to study/ui-catalog-app.zip");
        cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "8.4");
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 5s");
        cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
        cap.setCapability(MobileCapabilityType.APP, f.getAbsolutePath());
        IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
    }
}

7 个答案:

答案 0 :(得分:19)

我使用的是命令行Appium。要解决此问题,您必须将Xcode切换到正确的路径。

以下命令将有所帮助:

sudo xcode-select --switch /Applications/Xcode.app

如果您已在其他位置安装Xcode应用,请提供该路径而不是/Applications/Xcode.app。

答案 1 :(得分:3)

出现同样的问题,问题是XCode在Appium中的路径设置为&#34; xcode / library / developer / commandlinetools&#34;。 在高级iOS设置中设置正确的Xcode路径(在我的情况下:&#34; MacintoshHD / Applications / Xcode 2&#34;)解决了我的问题。(Xcode 7,Appium 1.4。 13)

答案 2 :(得分:3)

首先我使用重置它 sudo xcode-select --reset

然后使用 sudo xcode-select --switch /Applications/Xcode.app

注意:只需确保设置正确的Xcode路径(Application-&gt; Xcode)

答案 3 :(得分:1)

也许您正在使用Xcode 10,并且由于appium服务器问题而不支持appium,您可以返回Xcode ver 9.或使用appium beta

npm uninstall -g appium && npm install -g appium@beta

答案 4 :(得分:0)

解决此问题的最佳方法是将Xcode应用程序移动到mac机器上的Applications文件夹中。

答案 5 :(得分:0)

Xcode 10.1

检查是否已安装或启用了相应Xcode版本的命令行工具

答案 6 :(得分:0)

在打开appium桌面之前运行sudo xcode-select -r