Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)","origValue":"The following desired capabilities are required, but were not provided: deviceName"},"sessionId":null}
config files as below:
File 1:
{
"capabilities":
[
{
"browserName":"android",
"version":"4.4.2",
"maxInstances":5,
"platform":"ANDROID",
"applicationName": "2636B827AA05E6BB3"
}
],
"configuration":
{
"nodeTimeout":120,
"cleanUpCycle":2000,
"timeout":10000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:5566/wd/hub",
"maxSession":2,
"port":5566,
"register":true,
"registerCycle":5000,
"hub": "127.0.0.1:4441/grid/register",
"hubPort": 4441,
"hubHost": "127.0.0.1",
"role":"node"
}
}
File 2:
{
"capabilities":
[
{
"browserName":"android",
"version":"4.4",
"maxInstances":5,
"platform":"ANDROID",
"applicationName": "3061755BF088DF45"
}
],
"configuration":
{
"nodeTimeout":120,
"cleanUpCycle":2000,
"timeout":10000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:5577/wd/hub",
"maxSession":2,
"port":5577,
"register":true,
"registerCycle": 5000,
"hub": "127.0.0.1:4441/grid/register",
"hubPort": 4441,
"hubHost": "127.0.0.1",
"role":"node"
}
}
Selenium code:
for node 1:
@Parameters(value={"device_id1","device_id2", "ApplicationPath"})
@BeforeSuite//The annotated method will be run before all tests in this suite have run.
public static void atStart(@Optional("nnn") String device_id1, String device_id2, String ApplicationPath) throws InterruptedException, IOException
{
File app = new File(ApplicationPath);
capabilities=new DesiredCapabilities();
capabilities=DesiredCapabilities.android();
if ("2636B827AA05E6BB3".equals(device_id1))//FOR SAMSUNG GALAXY NOTE
{
System.out.println("in Samsung galaxy: "+device_id1);
capabilities.setCapability("automationName", "Appium");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "android");
//capabilities.setCapability("crazyNodeName", "One");
//samsung-sm_n750-3204da2a5075c0b5//micromax-micromax_a311-8a2d363//samsung-nexus_s-30345C56DC2000EC
capabilities.setCapability("applicationName", device_id1);
capabilities.setCapability("udid", device_id1);
capabilities.setCapability("deviceName","samsung-nexus_s-30345C56DC2000EC");//
capabilities.setCapability("platformVersion", "4.4.2");//Or//capabilities.setCapability(CapabilityType.VERSION, "4.1.2");
capabilities.setCapability(CapabilityType.PLATFORM,"ANDROID");
capabilities.setCapability("platformName", "ANDROID");//Or//capabilities.setCapability(CapabilityType.PLATFORM, "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
try
{
driver = new AndroidDriver(new URL("http://127.0.0.1:4441/wd/hub"), capabilities);
}
catch (Exception e)
{
System.out.println("didnt work for !" +device_id1);
}
}
:: The same code with some values change for node 2.
Can anyone please help understanding whats going wrong, or possible solution?
@Hassan_Radi @appium @appium_ia @Arvind_Patel
I have added deviceName in json files and have put the same in capabilities in script.
though I don't see any progress.