Hi,
I am trying to do parallel execution in Appium on android devices.I am trying to launch chrome browser in both and open one url. I could successfully do the following
- create a selenium grid
- Register the devices using appium nodes for each device on specific ports.
- Defined the device parameters in xml file and setting thread count = 2, parallel = “tests”
- when i run my script i could open the browser in both the devices simultaneously,
but at the time of opening the url, it works only in one device and the other keeps on waiting for the driver, after a specific time it shows session not found exception. Please find my script below.
Class file
_public class Appshowcase_grid {
public static String appurl1 = "https://www.facebook.com/";
public static String testName ="";
public static WebDriver dr1;
DesiredCapabilities capabilities = DesiredCapabilities.android();
@BeforeTest
@Parameters({“Test-Parallel”})
public void Setup() throws MalformedURLException {
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("deviceName", "05ec75b35a959924");
capabilities.setCapability("deviceName", "4d00bf0ec3d840f9");
//capabilities.setCapability("deviceName", "4300cab7ba3b9015");
capabilities.setCapability("platform", "Windows");
capabilities.setCapability("version", "5.0.1");
//capabilities.setCapability("version", "5.1.1");
capabilities.setCapability("browserName", "Chrome");
capabilities.setCapability("newCommandTimeout", "6000");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity", "com.google.Android.apps.chrome.Main");
System.out.println("Device capabilities tested");
}
@Test
public void Appshowcasehome() throws InterruptedException, MalformedURLException {
dr1 = new AndroidDriver(new URL (“http://10.224.28.27:4900/wd/hub”), capabilities);
dr1.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
dr1.get(appurl1);
long id = Thread.currentThread().getId();
System.out.println("Nexus device " + testName
+ ". Thread id is: " + id);
}
@Test
public void Appshowcasehome1() throws InterruptedException, MalformedURLException {
dr1 = new AndroidDriver(new URL ("http://10.224.28.27:4726/wd/hub"), capabilities);
dr1.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
dr1.get(appurl1);
long id = Thread.currentThread().getId();
System.out.println("Nexus device " + testName
+ ". Thread id is: " + id);
}
@AfterTest
public void teardown(){
try
{
dr1.quit();
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("not close");
}
}
}_
My XML
<?xml version="1.0" encoding="UTF-8"?>Can anyone help please???