Appium - Xcode中,选择抛出一个错误:找不到命令(Appium - xcode-se

2019-10-21 00:59发布

我试图用Appium,以测试在我的Mac OS X 10.9.3的iPhone模拟器我的应用程序。 我可以启动服务器正常,但当我尝试运行我的测试,我收到以下错误:

info: [debug] Error: xcode-select threw an error
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/helpers.js:499:10
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: xcode-select threw an error)","origValue":"xcode-select threw an error"},"sessionId":null}
info: <-- POST /wd/hub/session 500 31.780 ms - 176 

error: xcode-select threw error Error: Command failed: /bin/sh: xcode-select: command not found

我已经检查了bin / sh的文件夹,我的Xcode选文件不住在那里,而是位于位于/ usr / bin中。

我是否需要配置appium在Xcode的选文件USR / bin文件夹看看? 如果是的话我该怎么做呢?

还是有别的东西,我需要做什么?

其他信息:我使用的zsh,在我的.zshrc文件,我有以下几种:

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

(不知道这些信息是否有用)

另外我使用的RSpec /水豚为我的测试。 我已经加入了appium_capybara宝石,它安装了所有其他需要的宝石。 我已经添加了以下驱动程序信息:

desired_caps_ios = {
          platform:        "Mac",
          deviceName:      "iPhone Simulator",
          platformName:    "iOS",
          platformVersion: "7.1",
          app:             "/Applications/Appium.app/Contents/MacOS/my appname/Payload/appname.app"
      }

      url = "http://localhost:4723/wd/hub" # or a sauce labs url

      Capybara.register_driver(:appium) do |app|
        appium_lib_options = {
            server_url:           url
        }
        all_options = {
            appium_lib:  appium_lib_options,
            caps:        desired_caps_ios
        }
        Appium::Capybara::Driver.new app, all_options
      end

      Capybara.default_driver = :appium

Answer 1:

基于此commment (艾萨克是贡献者之一),Xcode中,选择应该/usr/bin ,它显然是。

我会去到安装Appium和运行appium-doctor --ios测试如果它认为一切都设置正确。 (这可以确保Xcode的命令行utils的安装是否正确)

如果没有,我建议用重装Appium appium-version-manager ( 链接 ),并尝试一些不同的版本Appium的。 如果是与Appium一个错误,我觉得更多的人会碰上它。



Answer 2:

好了,终于回来了这个问题。 好像我的问题是我安装Appium的方式。 我安装使用appium包。 删除了包,并通过节点安装,它似乎已经解决了这一问题的路径。



文章来源: Appium - xcode-select threw an error: command not found