Update:
Writing the parameters in xml above test tags resolved the problem.
Currently facing following error
Error forwarding the new session cannot find : Capabilities org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities [{app=D:\APKs\Automated_Projects\avaamo_staging.apk, appPackage=com.avaamo.android.staging, appActivity=com.avaamo.android.ui.LandingActivity, newCommandTimeout=2000000, platformVersion=4.4, automationName=Appium, browserName=Android, platformName=Android, deviceName=30345C56DC2000EC, platform=WINDOWS}]"
Following is the script:
@Parameters(value={"device_id1","device_id2"})
@BeforeSuite//The annotated method will be run before all tests in this suite have run.
public static WebDriver atStart(@Optional("nnn") String device_id1, String device_id2) throws InterruptedException, IOException
{
if ("226CF65ED0ABE221".equals(device_id1))//FOR SAMSUNG GALAXY NOTE
{
File app = new File(applicationPath);
capabilities.setCapability("automationName", "Appium");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "android");
//samsung-sm_n750-3204da2a5075c0b5//micromax-micromax_a311-8a2d363//samsung-nexus_s-30345C56DC2000EC
capabilities.setCapability("deviceName", "3204da2a5075c0b5");
// capabilities.setCapability("udid", "226CF65ED0ABE221");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.avaamo.android.staging"); //Replace with your app's package
capabilities.setCapability("appActivity", "com.avaamo.android.ui.LandingActivity"); //Replace with app's Activity
//setting new command timeout for selenium server
capabilities.setCapability("newCommandTimeout", "2000000");//33.33 mins
}
if("2636B827A05E6BB3".equals(device_id2))//fOR NEXUS ROOTED
{
System.out.println("in nexus: "+device_id2);
File app1 = new File(applicationPath);
capabilities.setCapability("automationName", "Appium");
capabilities.setCapability(CapabilityType.BROWSER_NAME,"android");
capabilities.setCapability("deviceName", "30345C56DC2000EC");
//capabilities.setCapability("udid", "2636B827A05E6BB3");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability(CapabilityType.PLATFORM, "WINDOWS");
capabilities.setCapability("platformName","ANDROID");
capabilities.setCapability("app", app1.getAbsolutePath());
capabilities.setCapability("appPackage", "com.avaamo.android.staging"); //Replace with your app's package
capabilities.setCapability("appActivity", "com.avaamo.android.ui.LandingActivity"); //Replace with app's Activity
//setting new command timeout for selenium server
capabilities.setCapability("newCommandTimeout", "2000000");//33.33 mins
}
return driver = new AndroidDriver(new URL("http://127.0.0.1:4441/wd/hub"), capabilities);
}
json files:
Node1.json
{
"capabilities":
[
{
"browserName": "android",
"version": "4.4.2",
"maxInstances": 5,
"platform": "ANDROID",
"deviceName": "3204da2a5075c0b5"
}
],
"configuration":
{
"nodeTimeout":120,
"cleanUpCycle":2000,
"timeout":2000000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4723/wd/hub",
"maxSession": 20,
"port": 4723,
"host": "127.0.0.1",
"register": true,
"registerCycle": 5000,
"hub": "127.0.0.1:4441/grid/register",
"hubPort": 4441,
"hubHost": "localhost"
}
}
Node2.json
{
"capabilities":
[
{
"browserName": "android",
"version": "4.4",
"maxInstances": 5,
"platform": "ANDROID",
"deviceName": "30345C56DC2000EC"
}
],
"configuration":
{
"nodeTimeout":120,
"cleanUpCycle":2000,
"timeout":2000000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:3000/wd/hub",
"maxSession": 20,
"port": 3000,
"host": "127.0.0.1",
"register": true,
"registerCycle": 5000,
"hub": "127.0.0.1:4441/grid/register",
"hubPort": 4441,
"hubHost": "localhost"
}
}
NOTE: Starting the nodes from appium gui providing the json files for respective nodes. and successfully connecting.
@Hassan_Radi @Appium_Master @Arvind_Patel Please suggest.