How to start the Appium server from command prompt in MAC machine?

I am automating ios native mobile application using appium. Until now I was launching the server from the Appium GUI by clicking on the Launch button. Now I want to start the server from a command prompt.

I was able to do the same in Windows machine by following the below steps:

  1. Launch Node.js command prompt
  2. Navigate till the Appium bin folder
  3. Use the command node appium

I got blocked on how to start the Node.js command prompt on a Mac. Can you pleases tell me how I can start the Appium server from a command prompt on a Mac.

Answers


if you used npm install -g appium then you should be able to directly open one with the command

appium //plus any server args you want ex: appium -p 4474 

Or you can still navigate to the folder of your node_modules and into appium and go with

node. //plus any server args you want

if you want to have additional server flags, all are available at their site with documentations.


/Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --chromedriver-port 9516 --bootstrap-port 4725 --no-reset --local-timezone --command-timeout 7200 --session-override --debug-log-spacing --platform-version 9.0 --platform-name iOS --app /Users/chennareddy/u/apps/TestApp/build/release-iphonesimulator/Handstand/Handstand.app --show-ios-log --device-name iPhone-6s --native-instruments-lib --orientation Portrait

Open the terminal and type in the following command

appium --address 127.0.0.1 --port 4723 

Press enter then it will register itself to 127.0.0.1 and will listen 4723 port. You can extend this command by adding app type etc.

Hope this will help you

cheers


To start appium in MAC, all you need to do is to type => appium & in the terminal application. In order for the above command to work, you have to install appium in terminal mode. However there are 2 ways of doing it, one is with HomeBrew and the other directly with Node.js . You can find the tutorial of installing HomeBrew online. Follow the steps below to install it directly with node.js -

  1. Go to https://nodejs.org/
  2. Download and install the latest stable version of node.js package in your mac
  3. Now open the terminal application
  4. Run the following command => npm install -g appium
  5. This should install Appium in your system with global privileges. After installation of appium, you can run the command => appium-doctor in the same terminal window to verify if everything is installed properly.
  6. If everything is in green ticks, run => appium & to start the appium server

Hope this helped.


As other answers points out, if you have installed Appium thru terminal then simply type appium & on a terminal window to start appium server. Here all you need to know, how to install appium thru terminal. 1. Install Homebrew.

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

2. Give Following commands one by one to install appium

brew install node      # get node.js
npm install -g appium  # get appium
npm install wd         # get appium client
appium &               # start appium

You can find refer to step by guide for appium download osx here.


String tellCommand = "tell application \"Terminal\" to do script \"/usr/bin/node_modules/appium/bin/appium.js";
        String parameters = " -p "+port;
        parameters += " "+ (fullReset ? "--full-reset" : "--no-reset")+"\"";
        tellCommand += parameters;

        String[] command = { "osascript", "-e",
        tellCommand };

        ProcessBuilder pBuilder = new ProcessBuilder(command);
        pBuilder.start();

Try this to launch your appium server programmatically for mac os, it includes automating the webkit debug proxy as well which is needed for debugging.

    //customize the below in start server method
//Webkit Proxy command

CommandLine iOSProxyCommand = new CommandLine("ios_webkit_debug_proxy");
iOSProxyCommand.addArgument("-c");
iOSProxyCommand.addArgument(udid+":27753");//provide your udid of the device
iOSProxyCommand.addArgument("-F");//to disable console output in eclipse

DefaultExecuteResultHandler iOSProxyresultHandler = new DefaultExecuteResultHandler();
DefaultExecutor iOSProxyexecutor = new DefaultExecutor();
iOSProxyexecutor.setExitValue(1);
try {
iOSProxyexecutor.execute(iOSProxyCommand, iOSProxyresultHandler);
iOSProxyCommand.toString()));
Thread.sleep(5000);
System.out.println("iOS Proxy started.");
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}

CommandLine command = new CommandLine(
"/Applications/Appium.app/Contents/Resources/node/bin/node");
command.addArgument( "/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js",
false);
command.addArgument("--address", false);
command.addArgument("127.0.0.1");
command.addArgument("--port", false);
command.addArgument("4723");
command.addArgument("--full-reset", false);
command.addArgument("--log-level", false);//to disable console output in eclipse
command.addArgument("error");
command.addArgument("--log", false);
Timestamp currentTimestamp = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
command.addArgument("/Users/sethupandi/appium"+currentTimestamp+".log");
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
try {
executor.execute(command, resultHandler);
Thread.sleep(5000);
System.out.println("Appium server started.");
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

//customize the below in stop appium server-

//kill appium node after end of your execution
String[] command = { "/usr/bin/killall", "-9", "node" };
try {
Runtime.getRuntime().exec(command);
System.out.println("Appium server stopped.");
} catch (IOException e) {
e.printStackTrace();
}
//Kill webkit proxy for iOS
String[] commandProxy = { "/usr/bin/killall", "-9", "ios_webkit_debug_proxy" };
try {
Runtime.getRuntime().exec(commandProxy);
System.out.println("iOS Webkit proxy stopped");
} catch (IOException e) {
e.printStackTrace();
}

For anybody reading this who happens to be using npm (node/js/typescript), I've created a module called appium-controller that starts and stops appium in the background programmatically (mac or windows). It has an option to pass in a specific port either through a node call to the method or through cli.


  • Install latest Android studio
  • Install Java SDK from : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  • Install Homebrew using
  • Install ruby: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • download installer: https://nodejs.org/en/download/and run
  • in terminal:
    • brew update
    • brew install node (if permission denied in post install then run "sudo chown -R $(whoami):admin /usr/local/lib/node_modules/“)
    • npm install -g npm
  • Update system preference:
open bash_profile in terminal:
  • nano ~/.bash_profile

    • paste following:
  • export ANDROID_HOME=/Users/jenkinss/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export JAVA_HOME=$(/usr/libexec/java_home)

    • save and exit
  • install Appium UI tool form here: https://bitbucket.org/appium/appium.app/downloads/appium-1.5.3.dmg
  • in Terminal install Appium command line:
  • npm install -g appium@1.7.1
npm install wd


  • now fix Appium beta with:
  • cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
  • brew install carthage

  • npm i -g webpack

  • ./Scripts/bootstrap.sh -d


  • npm install appium-doctor -g
  • run 'appium-doctor —android’ and fix the JAVA_PATH and ANDROID_PATH issues
  • run 'appium-doctor —ios’
  • install xcode command line tools if not installed : xcode-select —install
  • brew install libimobiledevice —HEAD
  • npm install -g ios-deploy
  • install appium-xcuitest driver : npm i appium-xcuitest-driver
  • Open WebDriverAgent.xcodeproj from /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent and sign the Lib and runner files
  • brew install ios-webkit-debug-proxy
  • got to : /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-xcode/
  • git clone https://github.com/facebook/WebDriverAgent
  • cd WebDriverAgent/
  • ./Scripts/bootstrap.sh
  • open WebDriverAgent.xcodeproj and sign lib and runner
  • git clone https://github.com/google/ios-webkit-debug-proxy.git
  • cd ios-webkit-debug-proxy
  • ./autogen.sh
  • make
  • sudo make install (installed in /usr/local/bin/ios_webkit_debug_proxy)

Need Your Help

Reactjs convert to html

javascript jquery ajax reactjs react-jsx

I'm having trouble dealing with facebook's ReactJS. Whenever I do ajax and want to display an html data, ReactJS displays it as text. (See figure below)

Yii CGridView hide filter input only

yii

When using CGridView, the filter input fields are automatically generated by the component.