Appium - Command line

梦想的初衷 提交于 2019-12-24 03:39:19

问题


Team,

Can you please guide me or point me some tutorials to run Appium through command line? I see lot of issues with Appium.app on MAC. It would be great, if you can share your knowledge or materials for me to move forward to run a sample application with appium through command line. Please refer my settings in appium.app for your reference.

Appium - Not able to launch the inspector

Logs:

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 

Thanks, Ramesh


回答1:


Using Appium from Command Line

Installation

  1. Open a terminal session
  2. Install homebrew (instructions)
  3. Run the below commands

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

Usage

Whenever you want to begin an appium server session, type appium to run the server.

Arguments can be added to that command.

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

Using Appium.app inspector with server

In my development env setup, I don't use the Appium.app server, but I DO use the inspector.

  1. Start your Appium server with the --app and --device-name arguments
  2. Click on the Appium.app inspector icon
  3. The iPhone Simulator will launch, and may give you an authorization prompt for Instruments to control it



回答2:


Setting up Appium

Mac:

Download and install Latest Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html Download and install latest Android SDK from http://developer.android.com/sdk/index.html Configure path to ANDROID_HOME and JAVA_HOME in .bash profile Configure path to Platform-tools and tools folder in .bash profile Install ruby

Install brew

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

Set path for brew from .bash profile

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

Install node:Paste the below commands one by one at terminal and hit enter

  brew update
  brew install node
  brew link node

Install appium

  npm install -g appium


  npm install wd

To start appium: Paste the below command at terminal and hit enter

  appium

Install Appium python client: Download source from https://github.com/appium/python-client Extract it, Navigate to the folder containing the Python client from terminal and install by: cd python-client

python setup.py install

IDE used: Pycharm

Linux: 

Download and install Latest Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html Download and install latest Android SDK from http://developer.android.com/sdk/index.html Configure path to ANDROID_HOME and JAVA_HOME in .bashrc profile Configure path to Platform-tools and tools folder in .bashrc profile command gedit.bashrc to open bash profile and specify path Install ruby Install linux brew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

Steps to get appium working on ubuntu pc :

Install ruby: Paste the below command at terminal and hit enter

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

Install linux brew:Paste the below command at terminal and hit enter ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

set path for brew

Type: gedit.bashrc at terminal and copy paste following into the .bashrc file

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

Install node:Paste the below commands one by one at terminal and hit enter

  brew update
  brew install node
  brew link node

Install appium

  npm install -g appium


  npm install wd

To start appium: Paste the below command at terminal and hit enter

  appium

Install Appium python client: Download source from https://github.com/appium/python-client Extract it, Navigate to the folder containing the Python client from terminal and install by: cd python-client

 python setup.py install

IDE used: Spyder/Pycharm You can get spyder by running command Sudo apt-get install Spyder Windows:

Download and install python 2.7.9 from https://www.python.org/downloads/ Download and install Latest Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html Download Android SDK from http://developer.android.com/sdk/index.html Set Environment variables to JAVA_HOME for Java , Python.exe for python and ANDROID_HOME to Android sdk, and Android Tools and platform tools.

IDE used: Pycharm

Download and install pycharm IDE from https://www.jetbrains.com/pycharm/ Install Appium python client: Download source from https://github.com/appium/python-client Extract it, Navigate to the folder containing the Python client from terminal and install by: cd python-client

python setup.py install Start node server by using Appium gui from windows PC



来源:https://stackoverflow.com/questions/26021570/appium-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!