Appium prallel device execution in multiple machines

Am using selenium grid with appium to run the testscript in multiple ios devices parallel in multiple machine(each machine having one iOS devices)

Steps i did
1.Started the hub in one machine
2.Started the node different machine pointing to hub
below is the nodeconfig.json
{
“capabilities”:
[
{
“browserName”:“iPhone 5s”,
“version”:“7.1.2”,
“maxInstances”: 1,
“platform”:“MAC”,
“platformName”:“iOS”,
“deviceName”:“iPhone 5s”
}
],
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:30000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:4723/wd/hub”,
“host”: “127.0.0.1”,
“port”: 4723,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “194.241.29.221”
}
}
3.Connect one iOS devices in each machine (where ever node started)
4.Executed the testscript from the hub machine.While executing getting the below exception
org.openqa.selenium.WebDriverException: Error forwarding the new
session new session request for webdriver should contain a location
header or an ‘application/json;charset=UTF-8’ response body with the session ID.
Command duration or timeout: 148 milliseconds
Build info: version: ‘2.43.1’, revision: '5163bce’

Note:
If start the hub,node and one iOS device in single am able to execute the script

please help me to fix the issue

Hi ,
Am using selenium grid with appium to run the testscript in multiple Android emulator parallel in multiple machine(each machine has one emulator opened )

Approach i followed
1.Started the hub using java -jar selenium-server-standalone-2.44.0.jar -port 4120 -role hub
2.Started the two node’s

  • Local machine
    Appium -a localhost -p 4723 -dp 1234 -u emulator-5556 --nodeconfig “path of my nodeconfig.json file”

Configuration fie for Local machine(nodeconfig.json)
{
“capabilities”: [
{
“browserName”: “browser”,
“version”: “4.4.2”,
“maxInstances”: 2,
“platform”: “WINDOWS”
}
],
“configuration”: {
“cleanUpCycle”: 2000,
“timeout”:30000,
“hub”: “http://localhost:4120/grid/register”,
“host”: “localhost”,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“maxSession”: 1,
“port”: 4723,
“hubPort”: 4120,
“hubHost”: “localhost”,
“url”: “http://localhost:4723/wd/hub”,
“remoteHost”: “http://localhost:4723”,
“register”: true,
“registerCycle”: 5000,
“role”: “node”
}
}

*** Another machine**

Appium -a Ip(of that machine) -p 4173 -dp 5678 -u emulator-5554 --nodeconfig “path of my nodeconfig2.json file”
nodeconfig2.json

{
“capabilities”: [
{
“browserName”: “browser”,
“version”: “4.4.2”,
“maxInstances”: 1,
“platform”: “Android”
“Emuator-Name” :“emulator-5554”
“Device” :“validdevice”

    }
],
"configuration": {
    "cleanUpCycle": 2000,
    "timeout":30000,
    "hub": "http://localhost:4120/grid/register",
    "host": "localhost",
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 1,
    "port": 4713,
    "hubPort": 4120,
    "hubHost": "localhost",
    "url": "http://l92.168.24.61:4713/wd/hub",
    "remoteHost": "http://l92.168.24.61:4713",
    "register": true,
    "registerCycle": 5000,
    "role": "node"
}

}

I Gave My DesiredCapabilities as Below

File app = new File(“C:\adt-bundle-windows-x86-20140702\Sudoku.apk”);
capabilities = new DesiredCapabilities();
capabilities.setCapability(“browserName”, “browserName”);

     capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
    
     capabilities.setCapability("deviceType", "phone");
     capabilities.setCapability("platformName", "Android");
     capabilities.setCapability("platformVersion", "version");
     capabilities.setCapability("device ID","Emuator-Name");
     capabilities.setCapability("deviceName","Device");
     capabilities.setCapability("app", app.getAbsolutePath());
     capabilities.setCapability("app-package","com.androidcan.asudoku");
     
     capabilities.setCapability("newCommandTimeout","180");
     
     }

@Test
public void Test() throws InterruptedException, MalformedURLException{
rdriver = new RemoteWebDriver(new URL(“http://localhost:4274/wd/hub”),capabilities);
rdriver = new RemoteWebDriver(new URL(“http://192.168.24.61:4713/wd/hub”),capabilities);

When i run the script , only one emulator ( from local machine) is running and other one is throwing the following error in appium
“info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Could not find aapt. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.)”,“origValue”:“Could not find aapt. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.”},“sessionId”:null}”

Note:
if i run the script from that machine (which throws the above error in appium) , its working fine

Please help me to find the solution

Have you tried to start the remote using the hub’s http://address:port/wd/hub (probably http://localhost:4444/wd/hub)? If you’re only getting one running locally, it’s because of the first line. You’ll want to register the remote machine with the hub as an available node and then the hub will send out the tests to it. I’ve successfully gotten this to work this way.

The Grid docs helped me out a lot when trying to initially set things up: GitHub - SeleniumHQ/selenium-google-code-issue-archive: Archive, please see main selenium repo

Thanks Christianklempwf,
Is there any possibility to run more than one emulator(parallely) in a machine using appium +selenium ?
If it possible , Then how ?
Kindly help me

It may be possible for Android, but not iOS. Only one iOS simulator can be running at any time. Doing so with Android and Genymotion may be possible, but I highly suspect it wouldn’t perform well.

Have you looked into the Sauce Labs remote solution? That may be your best bet, as you can run them in parallel on what ever device you specify. Check it out at https://saucelabs.com/

Hi All,

I also trying to execute appium script on multiple devices using selenium grid.

1 Like

possible in real device.

1 Like

@serdaraytac
Why I cannot get it work like yours
What are you doing differently that many of us cannot get it work? I have work on it for days and I still do cannot get to work any advice will be greatly appreciated.
My issue

Hi @serdaraytac can you plz guide me how you have successfully tested in ios device, as i am trying to connect 2 ios devices and failed to do so in mac. Any help will be much appreciated.

As far as i know…, In the above video, he was tested three devices,1-IOS, 2-Android devices were presented. So, in Mac only one iphone can be tested and remaining Android’s can also be tested along with parallel…!!!
Am i correct?

@serdaraytac
from what i’m seeing, however you were able to run tests on multiple devices, it is not happening in parallel, is it?

Hi,

Please share the steps, How did you set up all the things, Since I am new to appium.

Thanks in advance!
Astha

Messaging Applications Test

1 Like

You should start an appium per real device. Appium nodes should register to your selenium grid.
Android apps can be controlled by starting activity but for iphone you must sign app or ipa with your apple developer certificate.
And it should be generated for debug on real device.

And also you can start multiple appiums on a pc no need to use virtualization.
Connect all real devices to your mac android or iphone it does not matter.

You should start appium nodes with different ports.
Android: start with different bootstrap port
IOS : start with different --tmp folder parameter

Dont use virtualbox for multiple iphones because it causes log capture deviceconsole error. Virtualbox has some usb issues. You can test multiple iphone devices on the same MAC by giving --tmp parameter.

1 Like

Hi @suayipozmen, please share the steps.

@pr4bh4sh it is just simple as you will add only tmp parameter your appium command.

appium -p 6000 --nodeconfig /Users/testinium/iphone6.json -U SDFD43523SDF --tmp /tmp/iphone6
appium -p 7000 --nodeconfig /Users/testinium/iphone5c.json -U RG435G4J6535 --tmp /tmp/iphone5c

2 Likes

You sure about this? For me the test runs are not parallel but concurrent.

All devices are connected to same machine and junit tests are started at the same time.
What do you mean by concurrent?

Sorry I meant to say sequential. I’m using parametrized junit runner (separate thread for each device), and it works perfectly for android but not ios (using your example).
Whats happening is that while tests are started at the same time, its only one test actually running at the time - the other threads are paused.

Hi All,

I am trying to run parallel test on different OS by connecting to selenium Hub.
Here is my scenario:

Hub: On Windows machine
Node1: On same window machine as HUB
Node2: On Mac Machine.

I am trying to run on Android devices connected to both the OS.
I am able to run on Windows but on MAC appium is throwing an error "Unable to load node configuration file to register with grid"

Here is my both Node files:

Node1: {
“capabilities”:
[
{
“browserName”: “Android”,
“version”:“5.1.1”,
“udid”:“052d6d76002e47df”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“deviceName”:“google Nexus 5”
}],
“configuration”:

{
“nodeTimeout”:120,
“port”:4740,
“hubPort”:4444,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:4740/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: {
“capabilities”:
[
{
“browserName”: “Android”,
“version”:“4.3”,
“udid”:“4df742b317683077”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“deviceName”:“samsung GT-N7100”
}],
“configuration”:

{
“nodeTimeout”:120,
“port”:4728,
“hubPort”:4444,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://127.0.0.1:4728/wd/hub”,
“hub”: “10.123.23.123:4444/grid/register”,
“hubHost”:“10.123.23.123”,
“nodePolling”:2000,
“registerCycle”:10000,
“register”:true,
“cleanUpCycle”:2000,
“timeout”:30000,
“maxSession”:1
}
}