Appium错误:无法获取Xcode版本

p1tboqfb  于 2023-06-30  发布在  其他
关注(0)|答案(9)|浏览(235)

尝试在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);
    }
}
azpvetkf

azpvetkf1#

我使用命令行Appium。要解决这个问题,您必须将Xcode切换到正确的路径。
下面的命令将提供帮助:

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

如果你已经在不同的位置安装了Xcode app,那么就给予那个路径而不是/Applications/Xcode.app。

xmjla07d

xmjla07d2#

同样的问题,问题是Appium中的XCode路径被设置为“xcode/library/developer/commandlinetools”。设置正确的Xcode路径(在我的例子中:“MacintoshHD/Applications/Xcode 2”)在高级iOS设置中为我解决了这个问题。(Xcode 7,Appium 1.4.13)

o3imoua4

o3imoua43#

首先我使用sudo xcode-select --reset重置它
然后使用sudo xcode-select --switch /Applications/Xcode.app
注意:只要确保你设置了正确的Xcode路径(Application->Xcode)

x6yk4ghg

x6yk4ghg4#

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

4smxwvx5

4smxwvx55#

也许你正在使用Xcode版本10,它不支持appium,因为appium服务器问题,你可以回到Xcode ver 9.或使用appium beta

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

3htmauhk6#

两个原因
1.当你有两个版本的XCODE时。
1.当您的XCODE路径不正确时。
您可以通过以下步骤解决的第一个问题

  • 如果你的XCODE正在运行,那么关闭它& Appium
  • 将不必要的版本移到bin中。
  • 重置XCODE路径:sudo xcode-select --reset
  • 设置正确的路径:sudo xcode-select --switch /Applications/Xcode.app
  • 启动XCODE和Appium。

第二个问题你可以通过关闭XCODE并运行上面的两个命令来解决

  • 重置XCODE路径:sudo xcode-select --reset
  • 设置正确的路径:sudo xcode-select --switch /Applications/Xcode.app

如果问题还没有解决,请检查Appium版本并安装兼容版本。

ax6ht2ek

ax6ht2ek7#

解决这个问题的最好方法是将Xcode应用程序移动到Mac机器上的应用程序文件夹中。

vngu2lb8

vngu2lb88#

Xcode 11

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

fnatzsnv

fnatzsnv9#

设置正确的xcode版本后

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

您应该重启appium服务器

相关问题