This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
80 / 205
Apr 2015

In my case I am Using iOS Application.....so Please Help me out ....
As MY Application File Name Extension is DemoApp.app

Please send me code snippet if poossible.
Thanks,
Aiit.

Hello Husain,

In My case I am Getting Error as:

ERROR: The process "node.exe" not found

__I am trying to launch Appium Server for Android Application Testing on Android Simulator.

Yah ...Here it is:

package SampleTest;

import io.appium.java_client.AppiumDriver;

import java.io.File;
import java.io.IOException;

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;

import java.io.*;
import java.util.*;

import jxl.Workbook;
import jxl.read.biff.BiffException;

public class AppiumServer {

public void startServer(){
CommandLine command = new CommandLine("cmd");
command.addArgument("/c");
command.addArgument("D:\My_DEMO\Appium\Appium\node.exe");
command.addArgument("D:\My_DEMO\Appium\Appium\node_modules\appium\lib\appium.js");
command.addArgument("--address");
command.addArgument("127.0.0.1");
command.addArgument("--port");
command.addArgument("4724");
command.addArgument("--no-reset");
command.addArgument("--log");
command.addArgument("D:/appiumLogs.txt");
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);

try {
executor.execute(command, resultHandler);
} catch (IOException e) {
e.printStackTrace();
}
}

public void stopServer(){

CommandLine command = new CommandLine("cmd");
command.addArgument("/c");
command.addArgument("taskkill");
command.addArgument("/F");
command.addArgument("/IM");
command.addArgument("node.exe");

DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);

try {
executor.execute(command, resultHandler);
} catch (IOException e) {
e.printStackTrace();
}

}

public static void main(String[] args) throws BiffException, IOException {
AppiumServer server=new AppiumServer();
System.out.println("---- Starting appium server ----");
server.startServer();
System.out.println("---- Appium server started Successfully ! ----");

try{Thread.sleep(10000);}catch(Exception e){}

System.out.println("---- Stoping appium server ----");
server.stopServer();
System.out.println("---- Appium server stopped Successfully ! ----");

}

}

tried....no Change..getting same Error...now Check this out plz...

package myBeepsTest;

import io.appium.java_client.AppiumDriver;

import java.io.File;
import java.io.IOException;

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;

import java.io.*;
import java.util.*;

import jxl.Workbook;
import jxl.read.biff.BiffException;

public class AppiumServer {

public void startAppiumServer() throws IOException, InterruptedException {   
      
    CommandLine command = new CommandLine("cmd");
    command.addArgument("/c");  
    command.addArgument("c:/Appium/node.exe");  
    command.addArgument("c:/Appium/node_modules/appium/lib/appium.js");  
    command.addArgument("--address", false);  
    command.addArgument("127.0.0.1");  
    command.addArgument("--port", false);  
    command.addArgument("4723");  
    command.addArgument("--full-reset", false);  

    command.addArgument("C:/Appium/node.exe C:/Appium/node_modules/appium/bin/Appium.js --address 127.0.0.1 --chromedriver-port 9516 --bootstrap-port 4725 --selendroid-port 8082 --no-reset --local-timezone");
    
    DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();  
    DefaultExecutor executor = new DefaultExecutor();  
    executor.setExitValue(1);  
    executor.execute(command, resultHandler);  
  
}


public  void stopAppiumServer() throws IOException {  
    CommandLine command = new CommandLine("cmd");  
    command.addArgument("/c");  
    command.addArgument("Taskkill /F /IM node.exe");  
  
    DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();  
    DefaultExecutor executor = new DefaultExecutor();  
    executor.setExitValue(1);  
    executor.execute(command, resultHandler);  
     
}

public static void main(String as[]) throws IOException, InterruptedException
{
    AppiumServer aps = new AppiumServer();
    System.out.println("Starting Server...");
    aps.startAppiumServer();
    System.out.println("Server Started....");
    try{Thread.sleep(5000);}catch(Exception e){}
    System.out.println("Stopping Server");
    aps.stopAppiumServer();
    System.out.println("Server Stopped");
}

}

And Console Output (Error) for This code is:

Starting Server...
Server Started....
Stopping Server
Server Stopped
ERROR: The process "node.exe" not found.

This line should not be added as it is already covered by previous points. Please remove it and see what happens.

The server didn't start and that is why it is failing with the mentioned error. Can you try it with Java Process and see if it produces the same error??

even though if we put false for no-reset/full-reset..the logs are showing as true. Has anyone faced the same issue?

      command.addArgument("--full-reset", false);

or
command.addArgument("--no-reset", false);

The appium is launched as
[36minfo[39m: [debug] Non-default server args: {"address":"127.0.0.1","noReset":true,"log":"D:/appiumLogs.txt"}

Hello Hasan,
I've done with the gig....
But Using Batch File. where I have put command line and trying to execute batch file.

Now same Thing I want to Do to launch Appium Server for iOS Application on Mac OS.

Please help me out as I am new to Mac....and Commands into Mac OS.

Thanks,
Ajit JAdhav.

26 days later
10 days later

I'm getting an error like

C:/Program' is not recognized as an internal or external command,
operable program or batch file.

CODE:

public void startAppiumServer() throws IOException, InterruptedException {   

        CommandLine command = new CommandLine("cmd");
        command.addArgument("/c");
        command.addArgument("C:/Program Files (x86)/Appium/node.exe");  
        command.addArgument("C:/Program Files (x86)/Appium/node_modules/appium/lib/appium.js");  
        command.addArgument("--address", false);  
        command.addArgument("127.0.0.1");  
        command.addArgument("--port", false);  
        command.addArgument("4723");  
        command.addArgument("--full-reset", false);  

        DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();  
        DefaultExecutor executor = new DefaultExecutor();  
        executor.setExitValue(1);  
        executor.execute(command, resultHandler);
    }

Found the solution for this problem

Actually the space between the folder names is the root cause. The spaces should not occur in between the words.

C:/Program Files (x86)/Appium/node.exe

The Spaces should not occur

In Java I think you need to escape the spaces in double quotes. You could use single quotes to get around this.

8 days later

@Hassan_Radi Could you explain the meaning of it

command.addArgument("--address", true);
command.addArgument("127.0.0.1");

command.addArgument("--port", false);
command.addArgument("4722");

command.addArgument("--full-reset", false);

Hi Radha,

Can you please let us know how do you set up the ANDROID_HOME globally in MAC.

I am getting the same issue when running the appium launch via java code in eclipse

Thank you in Advance.

Regards
Gan

29 days later

Hi

The same code is not working for me on Mac. Can you help me with it.

I am getting NPE at appiumProcess.getWatchdog().destroyProcess();

Please help ASAP

Hi

Its working here after setting the capabilities properly.

Can you tell me how to launch an emulator programatically on Mac and Win.

Thanks,
Pradeep