【问题标题】:Appium - Command lineAppium - 命令行
【发布时间】:2015-05-21 20:51:33
【问题描述】:

团队,

您能否指导我或指出一些通过命令行运行 Appium 的教程?我在 MAC 上看到 Appium.app 有很多问题。如果您能分享您的知识或材料让我继续通过命令行运行带有 appium 的示例应用程序,那就太好了。请参考我在 appium.app 中的设置供您参考。

Appium - Not able to launch the inspector

日志:

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.2","revision":"cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4"}}}
info: <-- GET /wd/hub/status 200 1.335 ms - 104 {"status":0,"value":{"build":{"version":"1.2.2","revision":"cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4"}}}
info: --> GET /wd/hub/sessions {}
info: [debug] Responding to client with success: {"status":0,"value":[]}
info: <-- GET /wd/hub/sessions 200 2.145 ms - 23 {"status":0,"value":[]}
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"iOS","platformVersion":"7.1","newCommandTimeout":"999999","automationName":"Appium","deviceName":"iPhone Simulator"}}
info: [debug] Using local app from command line: /Users/rsangili/Desktop/temp/Payload/TestApp2.app
info: [debug] Creating new appium session dd2c8121-6a13-48be-8a0b-9fc6233437a5
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] iOS SDK Version set to 7.1
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
error: Could not parse plist file (as binary) at /Users/rsangili/Desktop/temp/Payload/TestApp2.app/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
error: Could not parse plist file (as XML) at /Users/rsangili/Desktop/temp/Payload/TestApp2.app/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings
info: [debug] Not setting locale
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir:
info: [debug] Dynamic env:
info: [debug] Dynamic bootstrap code:
info: [debug] Dynamic bootstrap path:
info: [debug] Reusing dynamic bootstrap:
info: [debug] Fixing device was changed from:"
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 7.* simulator log capture
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: [debug] Fixing device was changed from:"
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: 
info: [debug] Error: Command failed: 
    at ChildProcess.exithandler (child_process.js:648:15)
    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: Command failed: )","killed":true,"code":null,"signal":"SIGTERM","origValue":"Command failed: "},"sessionId":null}
info: <-- POST /wd/hub/session 500 6381.780 ms - 199 

谢谢, 拉梅什

【问题讨论】:

    标签: ios7.1 appium


    【解决方案1】:

    从命令行使用 Appium

    安装

    1. 打开终端会话
    2. 安装自制软件 (instructions)
    3. 运行以下命令

     $ brew install node # install node and npm
     $ npm install -g appium # globally install appium
     $ npm install wd
     $ appium # Launch your appium server!
    

    用法

    当你想开始一个 appium 服务器会话时,输入appium 来运行服务器。

    参数可以添加到该命令中。

    appium --app path/to/app --device-name "iPhone Simulator"

    将 Appium.app 检查器与服务器一起使用

    在我的开发环境设置中,我不使用 Appium.app 服务器,但我确实使用了检查器。

    1. 使用 --app--device-name 参数启动您的 Appium 服务器
    2. 点击 Appium.app 检查器图标
    3. iPhone 模拟器将启动,可能会提示您授权 Instruments 来控制它

    【讨论】:

    • 感谢您的回复。我面临以下问题usdal1lt00097:deviceconsole rsangili$ sudo grunt authorize-ios >> 未找到本地 Npm 模块“grunt-newer”。安装了吗? >> 未找到本地 Npm 模块“grunt-mocha-test”。安装了吗? >> 未找到本地 Npm 模块“grunt-contrib-jshint”。安装了吗? >> 未找到本地 Npm 模块“grunt-jscs-checker”。安装了吗?警告:找不到任务“authorize-ios”。使用 --force 继续。由于警告而中止。
    • 我尝试了以下命令 usdal1lt00097:deviceconsole rsangili$ appium --app /Users/rsangili/Desktop/temp/Payload/TestApp2.app --device-name "iPhone Simulator" info: Welcome to Appium v1.2.2 (REV cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4) 信息:Appium REST http 接口监听器开始于 0.0.0.0:4723 信息:[debug] 非默认服务器参数:{"app":"/Users/rsangili/Desktop/temp/Payload/TestApp2 .app","deviceName":"iPhone Simulator"} 信息:LogLevel:调试
    • 我的模拟器没有启动,日志中没有任何指示
    • 你的模拟器只会在你启动inspector或者你的测试启动webdriver时启动
    • @sheeptest。当您在终端中设置“--device-name”等功能时,您如何在代码中创建驱动程序实例?您是否仍然在代码中创建 DesiredCapabilities 但排除了设备名称?
    【解决方案2】:

    设置 Appium

    Mac:
    

    http://www.oracle.com/technetwork/java/javase/downloads/index.html 下载并安装最新的 Java 从http://developer.android.com/sdk/index.html 下载并安装最新的 Android SDK 在 .bash 配置文件中配置 ANDROID_HOME 和 JAVA_HOME 的路径 在 .bash 配置文件中配置 Platform-tools 和 tools 文件夹的路径 安装红宝石

    安装 brew

        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
    

    从 .bash 配置文件设置 brew 的路径

      export PATH="$HOME/.linuxbrew/bin:$PATH"
      export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
      export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
    

    安装节点:将以下命令一一粘贴到终端并回车

      brew update
      brew install node
      brew link node
    

    安装appium

      npm install -g appium
    
    
      npm install wd
    

    要启动appium:将以下命令粘贴到终端并回车

      appium
    

    安装 Appium python 客户端: 从下载源 https://github.com/appium/python-client 提取它,从终端导航到包含 Python 客户端的文件夹并通过以下方式安装: cd python-client

    python setup.py install
    

    使用的IDE:Pycharm

    Linux: 
    

    http://www.oracle.com/technetwork/java/javase/downloads/index.html 下载并安装最新的 Java 从http://developer.android.com/sdk/index.html 下载并安装最新的 Android SDK 在 .bashrc 配置文件中配置 ANDROID_HOME 和 JAVA_HOME 的路径 在 .bashrc 配置文件中配置 Platform-tools 和 tools 文件夹的路径 命令 gedit.bashrc 打开 bash 配置文件并指定路径 安装红宝石 安装 linux brew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

    让 appium 在 ubuntu pc 上运行的步骤:

    安装 ruby​​:将以下命令粘贴到终端并回车

      sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
    

    安装 linux brew: 将以下命令粘贴到终端并回车 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

    设置 brew 路径

    在终端键入:gedit.bashrc 并将以下内容复制粘贴到 .bashrc 文件中

      export PATH="$HOME/.linuxbrew/bin:$PATH"
      export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
      export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
    

    安装节点:将以下命令一一粘贴到终端并回车

      brew update
      brew install node
      brew link node
    

    安装appium

      npm install -g appium
    
    
      npm install wd
    

    要启动appium:将以下命令粘贴到终端并回车

      appium
    

    安装 Appium python 客户端: 从下载源 https://github.com/appium/python-client 提取它,从终端导航到包含 Python 客户端的文件夹并通过以下方式安装: cd python-client

     python setup.py install
    

    使用的IDE:Spyder/Pycharm 您可以通过运行命令获取 spyder sudo apt-get install Spyder 窗户:

    https://www.python.org/downloads/下载并安装python 2.7.9 从http://www.oracle.com/technetwork/java/javase/downloads/index.html 下载并安装最新的 Java 从http://developer.android.com/sdk/index.html下载Android SDK 将环境变量设置为 Java 的 JAVA_HOME ,Python.exe 的 python 和 ANDROID_HOME 的 Android sdk 和 Android 工具和平台工具。

    使用的IDE:Pycharm

    https://www.jetbrains.com/pycharm/下载并安装pycharm IDE 安装 Appium python 客户端: 从下载源 https://github.com/appium/python-client 提取它,从终端导航到包含 Python 客户端的文件夹并通过以下方式安装: cd python-client

    python setup.py 安装 从 Windows PC 使用 Appium gui 启动节点服务器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-31
      • 2018-09-08
      • 1970-01-01
      • 2019-11-26
      • 1970-01-01
      • 1970-01-01
      • 2014-07-04
      相关资源
      最近更新 更多