使用Json的appium并行执行

使用Json的appium并行执行,appium,Appium,我的json文件是: node1.json { "capabilities": [ { "browserName": "Android", "version”:”5.0.2”, "maxInstances": 3, "platform":"ANDROID", "deviceName”:”X1033” } ], "configuration": { "nodeTimeout":120, "port":4723, "hubPort":4444, "proxy": "org.openqa.grid

我的json文件是:

node1.json

{
"capabilities":
[
{
"browserName": "Android",
"version”:”5.0.2”,
"maxInstances": 3,
"platform":"ANDROID",
"deviceName”:”X1033”
}
],
"configuration":
{
"nodeTimeout":120, 
"port":4723, 
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4723/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
}
}
{
"capabilities":
[
{
"browserName": "Android",
"version":"5.1",
"maxInstances": 3,
"platform":"ANDROID",
"deviceName”:”X1033”
}
],
"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
}
}
node2.json

{
"capabilities":
[
{
"browserName": "Android",
"version”:”5.0.2”,
"maxInstances": 3,
"platform":"ANDROID",
"deviceName”:”X1033”
}
],
"configuration":
{
"nodeTimeout":120, 
"port":4723, 
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4723/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
}
}
{
"capabilities":
[
{
"browserName": "Android",
"version":"5.1",
"maxInstances": 3,
"platform":"ANDROID",
"deviceName”:”X1033”
}
],
"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
}
}
在端口4723和4728上打开了2个应用程序

使用以下命令在mac上启动网格:

java -jar selenium-server-standalone-2.48.2.jar -role hub
java -jar selenium-server-standalone-2.48.2.jar -role node -hub http://localhost:4444/grid/register —port 4723 -nodeConfig node1.json
使用命令启动节点:

java -jar selenium-server-standalone-2.48.2.jar -role hub
java -jar selenium-server-standalone-2.48.2.jar -role node -hub http://localhost:4444/grid/register —port 4723 -nodeConfig node1.json
获取错误:

Mac-mini:jar intelligrape$ java -jar selenium-server-standalone-2.48.2.jar -role node -hub http://localhost:4444/grid/register —port 4723 -nodeConfig node1.json
16:16:30.700 INFO - Launching a Selenium Grid node
Error building the config :Error with the JSON of the config : Wrong format for the JSON input : com.google.gson.stream.MalformedJsonException: Expected name at line 1 column 2 path $.
Usage: java -jar selenium-server.jar -role node [options]

-host:
: usually not needed and determined
automatically. For exotic network configuration, network with
VPN, specifying the host might be necessary.

-port:
: the port the remote/hub will listen on. Default to 4444.

-cleanupCycle:
in ms. How often a proxy will check for timed out thread.

-timeout:
the timeout in seconds before the hub automatically ends
a test that hasn't had any activity in the last X seconds. The
browser will be released for another test to use. This typically
takes care of the client crashes.

-browserTimeout:
The timeout in seconds a browser can hang

-hub:
http://localhost:4444/grid/register : the url that will be used
to post the registration request. This option takes precedence
over -hubHost and -hubPort options.

-hubHost:
: the host address of a hub the registration
request should be sent to. Default to localhost. Option -hub
takes precedence over this option.

-hubPort:
: the port listened by a hub the registration request
should be sent to. Default to 4444. Option -hub takes precedence
over this option.

-proxy:
the class that will be used to represent the node. By default
org.openqa.grid.selenium.proxy.DefaultRemoteProxy.

-maxSession:
max number of tests that can run at the same time on the node,
independently of the browser used.

-registerCycle:
how often in ms the node will try to register itself again.Allow
to restart the hub without having to restart the nodes.

-nodePolling:
in ms. Interval between alive checks of node how often the hub
checks if the node is still alive.

-unregisterIfStillDownAfter:
in ms. If the node remains down for more than
unregisterIfStillDownAfter millisec, it will disappear from the
hub.Default is 1min.

-downPollingLimit:
node is marked as down after downPollingLimit alive checks.

-nodeStatusCheckTimeout:
in ms. Connection and socket timeout which is used for node alive
check.

This synopsis lists options available in node role only. To get help
on the command line options available for other roles run the server
with -help name and the corresponding -role name value.
org.openqa.grid.common.exception.GridConfigurationException: Error with the JSON of the config : Wrong format for the JSON input : com.google.gson.stream.MalformedJsonException: Expected name at line 1 column 2 path $.
at org.openqa.grid.common.RegistrationRequest.loadFromJSON(RegistrationRequest.java:574)
at org.openqa.grid.common.RegistrationRequest.build(RegistrationRequest.java:378)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:83)
Caused by: org.openqa.grid.common.exception.GridConfigurationException: Wrong format for the JSON input : com.google.gson.stream.MalformedJsonException: Expected name at line 1 column 2 path $.
at org.openqa.grid.common.JSONConfigurationUtils.loadJSON(JSONConfigurationUtils.java:81)
at org.openqa.grid.common.RegistrationRequest.loadFromJSON(RegistrationRequest.java:550)
... 2 more
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected name at line 1 column 2 path $.
at com.google.gson.internal.Streams.parse(Streams.java:56)
at com.google.gson.JsonParser.parse(JsonParser.java:84)
at com.google.gson.JsonParser.parse(JsonParser.java:59)
at com.google.gson.JsonParser.parse(JsonParser.java:45)
at org.openqa.grid.common.JSONConfigurationUtils.loadJSON(JSONConfigurationUtils.java:79)
... 3 more
Caused by: com.google.gson.stream.MalformedJsonException: Expected name at line 1 column 2 path $.
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1573)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:517)
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:418)
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:666)
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642)
at com.google.gson.internal.Streams.parse(Streams.java:44)
... 7 more

用这个。你版本的倒逗号给了我一个错误。可能有点问题。检查这是否有效。node2配置文件也有相同的错误。也要把它们修好。类似于
“deviceName”:“X1033”
它应该是
“deviceName”:“X1033”


嗨,我也有同样的问题,你是怎么解决的??