@rgonalo @Hassan_Radi @Arvind_Patel,
I am trying to run the my test cases parallel on 3 devices connected to my machine
I am trying to launch the same test cases for different devices using the method described below.
[Launching and stopping appium server programatically][1].
Please can you guide me on how to launch appium server programmatically using node config.json.
1) I launching grid through command prompt: java -jar selenium-server-standalone.jar -role hub
2) I am executing the below code to launch appium server with nodeconfig.json
Below is the Code which i am trying to execute:
package Test;
import io.appium.java_client.AppiumDriver;
import java.io.IOException;
import java.net.URL;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.exec.Executor;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class NewTrial
{
public static void main(String[] args) throws ExecuteException, IOException
{
AppiumDriver driver;
DefaultExecuteResultHandler resultHandler;
Executor executor ;
CommandLine command = new CommandLine("cmd");
command.addArgument("/c");
command.addArgument("C:\Users\mkarthik\Documents\selenium\Appium\node.exe");
command.addArgument("C:\Users\mkarthik\Documents\selenium\Appium\node_modules\appium\bin\appium.js");
command.addArgument("--nodeconfig");
command.addArgument("C:\Users\mkarthik\Documents\nodeconfig.json");
command.addArgument("--bootstrap-port");
command.addArgument("4724");
resultHandler = new DefaultExecuteResultHandler();
executor = new DefaultExecutor();
executor.setExitValue(1);
System.out.println("command: "+command);
executor.execute(command, resultHandler);
DesiredCapabilities capabilities=new DesiredCapabilities();
URL url=new URL("http://localhost:4444/wd/hub");
capabilities.setCapability(CapabilityType.VERSION, "5.0");
capabilities.setCapability("deviceName", "hammerhead");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("udid","085d3b920c928938");
driver = new AppiumDriver(url, capabilities);
driver.get("http://www.google.com");
}
}
Below is the error i am getting:
command: cmd /c C:\Users\mkarthik\Documents\selenium\Appium\node.exe C:\Users\mkarthik\Documents\selenium\Appium\node_modules\appium\bin\appium.js --nodeconfig C:\Users\mkarthik\Documents\nodeconfig.json --bootstrap-port 4724
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities [{deviceName=hammerhead, platformName=Android, udid=085d3b920c928938, version=5.0}]
Command duration or timeout: 249 milliseconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'mkarthik-W7', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_40'
Driver info: io.appium.java_client.AppiumDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:88)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:44)
at Test.NewTrial.main(NewTrial.java:57)
Caused by: org.openqa.grid.common.exception.GridException: Error forwarding the new session Empty pool of VM for setup Capabilities [{deviceName=hammerhead, platformName=Android, udid=085d3b920c928938, version=5.0}]
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:114)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Unknown Source)
[36minfo[39m: Welcome to Appium v1.2.0 (REV e53f49c706a25242e66d36685c268b599cc18da5)
[90mdebug[39m: Non-default server args: {"nodeconfig":"C:\Users\mkarthik\Documents\nodeconfig.json"}
[36minfo[39m: Appium REST http interface listener started on 0.0.0.0:4723
[36minfo[39m: LogLevel: debug
[90mdebug[39m: starting auto register thread for grid. Will try to register every 10000 ms.
[90mdebug[39m: Appium successfully registered with the grid on 127.0.0.1:4444
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 4.760 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.943 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.712 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.586 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.581 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.587 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 1.939 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.532 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 1.044 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 1.581 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.547 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 1.643 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 0.944 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
[36minfo[39m: [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m [90m{}[39m
[36minfo[39m: [37m<-- GET /wd/hub/status [39m[32m200[39m[90m 1.161 ms - 104[39m [90m{"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}[39m
[90mdebug[39m: Appium request initiated at /wd/hub/status
[90mdebug[39m: Request received with params: {}
[90mdebug[39m: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
Below is the nodeconfig.json
{
"capabilities":
[
{
"browserName": "chrome",
"version": "5.0",
"maxInstances": 1,
"platform": "ANDROID",
"deviceName": "hammerhead"
}
],
"configuration":
{
"nodeTimeout":120,
"port":4728,
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4728/wd/hub",
"hub": "127.0.0.1:4444/grid/register",
"hubHost":"127.0.0.1",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000,
"maxSession":1
}
}
Kindly help.
Thanks and regards,
M.Karthik