i am getting below error while i am running parallel test scripts in appium (Android)with Selenium grid.
Default suite Total tests run: 6, Failures: 0, Skips: 3 Configuration Failures: 1, Skips: 0
Stack trace message: org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress) My TestNG xml file:
<suite name="Default suite" thread-count="4" parallel="tests">
<test name="Nexus">
<Parameters>
<parameter name="platform" value="Nexus"/>
<parameter name="browsername" value="Android"/>
<parameter name="remoteurl" value="http://0.0.0.0:4723/wd/hub"/>
</Parameters>
<classes>
<class name="AppiumTest">
<methods>
<include name="Test1"/>
<include name="Test2"/>
<include name="Test3"/>
</methods>
</class>
</classes>
</test>
<test name="Moto E">
<Parameters>
<parameter name="platform" value="Moto E"/>
<parameter name="browsername" value="Android"/>
<parameter name="remoteurl" value="http://0.0.0.0:4726/wd/hub"/>
</Parameters>
<classes>
<class name="AppiumTest">
<methods>
<include name="Test1"/>
<include name="Test2"/>
<include name="Test3"/>
</methods>
</class>
</classes></suite>
Config.Json file:
{
"capabilities":
[
{
"browserName":"Nexus",
"version":"5.1.1",
"maxInstances": 1,
"platform":"ANDROID"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://0.0.0.0:4723/wd/hub",
"host":"192.168.50.114",
"port": 4723,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4448,
"hubHost": "192.168.50.114"
}
}
Command for selenium node: appium --nodeconfig path/to/json file.
Test script:
public class AppiumTest { //static RemoteWebDriver driver;
@SuppressWarnings("rawtypes")
public static AndroidDriver driver;
@SuppressWarnings("rawtypes")
@org.testng.annotations.BeforeTest
public static void setUp() throws MalformedURLException{
DesiredCapabilities capabilities=new DesiredCapabilities();
capabilities.setCapability("deviceName","Nexus");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("appPackage","club.apptu.basic.callrecorder");
capabilities.setCapability("appActivity","MainActivity");
driver=new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
}
@org.testng.annotations.Test
public void Test1(){
turnonoff();
turnonoff();
//longclick();
// important();
// delete();
// deleterecord();
// scroll();
// languagechange();
}
@org.testng.annotations.Test
public void Test2(){
drawer();
drawer();
}
@org.testng.annotations.Test
public void Test3(){
clickonitem();
play();
pause();
}
Any suggestions would be appreciated.