Enter code here...package Configuration;
import android.graphics.drawable.Animatable;
import org.openqa.grid.internal.utils.GridHubConfiguration;
import org.openqa.grid.web.Hub;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.server.SeleniumServer;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Parameters;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.ServerArgument;
public class BaseSetup {
protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();
private SeleniumServer hub;
@Parameters({"deviceName","platformVersion","udid","URL_","Sport","deviceId","sysPort","bootStrap","wdaPort","path"})
@BeforeMethod(alwaysRun = true)
public void setUp (String deviceName, String platformVersion, String udid, String URL_, String Sport, String deviceId, String sysPort, String bootStrap, String wdaPort, String path) throws Exception {
GridHubConfiguration config = new GridHubConfiguration();
config.loadFromJSON("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/selenium/config.json");
Hub hub = new Hub(config);
hub.start();
Thread.sleep(10000);
System.out.println("Driver Is Initiated");
DesiredCapabilities dc = new DesiredCapabilities();
// Mobile setup
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
dc.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, sysPort);
// dc.setCapability("appium:unlockType", "password");
// dc.setCapability("appium:unlockKey", "@0122882435abA");
// dc.setCapability(MobileCapabilityType.UDID,udid_);
// dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2"); // Make the test fail after first tear down "BROWSER_TIMEOUT"
// dc.setCapability("appium:uiautomator2ServerInstallTimeout", "8000");
// Application setup
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.sarajevo.food.dictionary");
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.sfdmobile.MainActivity");
dc.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.sfdmobile.MainActivity");
dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,"true");
dc.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
// Driver configuration
// int port = Integer.parseInt(Sport); //need when use function .using
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
.withArgument(Arg.ADDRESS,URL_)
.withArgument(Arg.PORT,Sport)
.withArgument(Arg.CALLBACKPORT,Sport)
.withArgument(Arg.WDALOCALPORT,wdaPort)
.withArgument(Arg.BootstrapPort,bootStrap)
.withArgument(Arg.NODECONFIG,path)
.withArgument(Arg.SESSIONOVERRIDE));
service.start();
// Thread.sleep(7000); // Needed for appium server to wait for selenium grid to register the node
driver = new AndroidDriver (new URL("http://localhost:4444/wd/hub"), dc);
//Thread.sleep(5000);
// threadLocalDriver.setTLDriver(new AndroidDriver<MobileElement>(new URL("http://"+URL_+":"+Sport+"/wd/hub"),dc));
// threadLocalDriver.setTLDriver(new AndroidDriver<MobileElement>(new URL("http://localhost:4444/wd/hub"),dc));
// driver = threadLocalDriver.getTLDriver();
// wait = new WebDriverWait(driver, 10);
}
@AfterMethod
public void tearDown(){
if (driver != null)
driver.quit();
System.out.println("Driver quit");
}
// @AfterMethod
// public synchronized void teardown() {
// if (driver != null)
// driver.quit();
// }
}
Enter code here.....Basically, there are two issues here.
This is the grid’s way of telling you that the hub came up, but it had no nodes attached to it. So, it can’t service any tests.
It looks like you are trying to start two instances of the Selenium Grid. Going by your earlier post on this, I guess its because you start off the Hub via a @BeforeClass and you have two <test> tags in your suite file and you have configured parallel=”tests”. So TestNG is going to attempt to start both the <tests> in parallel causing the @BeforeClass (where the hub is being started) to be done concurrently. You need to relook at the way in which you are starting your Hub. Ideally speaking you should just start the Hub once per <suite> [ preferably within a @BeforeSuite ] and manage your Appium nodes via a @BeforeTest (so that it starts once per <test> tag ]
Here’s a very crude sample that shows how to start a hub, have a Appium node registered to it and then run tests against it.
Sample code:
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import java.util.concurrent.TimeUnit;
import org.hamcrest.Matchers;
import org.openqa.grid.common.exception.GridException;
import org.openqa.grid.selenium.GridLauncherV3;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class AppTest {
private AppiumDriverLocalService service;
@BeforeClass
public void setup() throws InterruptedException {
Thread hub = new Thread(this::startHub);
hub.start();
waitForGridToComeUp();
Thread node = new Thread(this::startupAppiumAsNode);
node.start();
TimeUnit.SECONDS.sleep(10);
}
@AfterClass
public void cleanup() {
service.stop();
}
@Test
public void testMethod() {
System.err.println("Printing the Hub status");
Response response = RestAssured
.get("http://localhost:4444/grid/api/hub").andReturn();
System.err.println(response.getBody().prettyPrint());
response.then().assertThat().statusCode(200);
response = RestAssured
.get("http://localhost:4444/wd/hub/status").andReturn();
System.err.println("Printing status");
System.err.println(response.getBody().prettyPrint());
response.then().assertThat().body("value.message", Matchers.equalTo("Hub has capacity"));
response.then().assertThat().statusCode(200);
}
private void startupAppiumAsNode() {
AppiumServiceBuilder builder = new AppiumServiceBuilder().usingAnyFreePort()
.withArgument(GeneralServerFlag.CONFIGURATION_FILE, "src/test/resources/config.json");
service = AppiumDriverLocalService.buildService(builder);
service.start();
try {
waitForAppiumNodeToComeUp();
} catch (InterruptedException e) {
throw new GridException(e.getMessage(), e);
}
}
private void startHub() {
String[] args = new String[]{
"-role",
"hub",
"-host",
"localhost"
};
GridLauncherV3.main(args);
}
private void waitForAppiumNodeToComeUp()
throws InterruptedException {
boolean flag = true;
while (flag) {
if (service.isRunning()) {
flag = false;
}
TimeUnit.SECONDS.sleep(5);
}
}
private void waitForGridToComeUp() throws InterruptedException {
while (true) {
if (!isGridUp()) {
TimeUnit.SECONDS.sleep(5);
} else {
break;
}
}
}
private boolean isGridUp() {
Response response = RestAssured
.get("http://localhost:4444/wd/hub/status").andReturn();
return response.statusCode() == 200;
}
}
Dependencies that I have used:
<dependencies>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
The JSON configuration file
{
"capabilities": [
{
"maxInstances": 1,
"platform": "Android"
}
],
"configuration": {
"cleanUpCycle": 2000,
"timeout": 30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"host": "localhost",
"hubHost": "localhost"
}
}
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.com/
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f7f62236-9450-4d53-97fb-b032ca9cdcd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Enter code here...package Configuration;
import android.graphics.drawable.Animatable;
import org.openqa.grid.common.GridRole;
import org.openqa.grid.common.RegistrationRequest;
import org.openqa.grid.common.exception.GridException;
import org.openqa.grid.internal.utils.GridHubConfiguration;
import org.openqa.grid.internal.utils.SelfRegisteringRemote;
import org.openqa.grid.selenium.proxy.DefaultRemoteProxy;
import org.openqa.grid.web.Hub;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.server.SeleniumServer;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.BindException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.ServerArgument;
public class BaseSetup extends GridHub {
protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();
private SeleniumServer hub;
@Parameters({"deviceName","platformVersion","udid","URL_","Sport","deviceId","sysPort","bootStrap","wdaPort","path"})
@BeforeMethod(alwaysRun = true)
public void setUp (String deviceName, String platformVersion, String udid, String URL_, String Sport, String deviceId, String sysPort, String bootStrap, String wdaPort, String path) throws Exception {
System.out.println("Driver Is Initiated");
DesiredCapabilities dc = new DesiredCapabilities();
// Mobile setup
// dc.setCapability("deviceId", deviceId);
// dc.setCapability("automationName", "uiautomator2");
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
dc.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, sysPort);
dc.setCapability(MobileCapabilityType.UDID,udid);
// dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2"); // Make the test fail after first tear down "BROWSER_TIMEOUT"
// dc.setCapability("appium:uiautomator2ServerInstallTimeout", "8000");
// Application setup
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "y");
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "");
dc.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.ty");
dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,"true");
dc.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
// Driver configuration
// int port = Integer.parseInt(Sport); //need when use function .using
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
.withArgument(Arg.ADDRESS,URL_)
.withArgument(Arg.PORT,Sport)
.withArgument(Arg.CALLBACKPORT,Sport)
.withArgument(Arg.WDALOCALPORT,wdaPort)
.withArgument(Arg.BootstrapPort,bootStrap)
.withArgument(Arg.NODECONFIG,path)
.withArgument(Arg.SESSIONOVERRIDE));
service.start();
try {
waitForAppiumNodeToComeUp();
} catch (InterruptedException e) {
throw new GridException(e.getMessage(), e);
}
// Thread.sleep(10000); // Needed for appium server to wait for selenium grid to register the node
// Thread.currentThread().join();
driver = new AndroidDriver (new URL("http://localhost:4444/wd/hub"), dc);
//Thread.sleep(5000);
//// threadLocalDriver.setTLDriver(new AndroidDriver<MobileElement>(new URL("http://"+URL_+":"+Sport+"/wd/hub"),dc));
// threadLocalDriver.setTLDriver(new AndroidDriver<MobileElement>(new URL("http://localhost:4444/wd/hub"),dc));
// driver = threadLocalDriver.getTLDriver();
// wait = new WebDriverWait(driver, 10);
}
private void waitForAppiumNodeToComeUp()
throws InterruptedException {
boolean flag = true;
while (flag) {
if (service.isRunning()) {
flag = false;
}
TimeUnit.SECONDS.sleep(5);
}
}
@AfterMethod
public void tearDown() throws InterruptedException {
if (driver != null)
TimeUnit.SECONDS.sleep(2);
// driver.quit(); //will lead to unexpected behaviour during teardown, some test will fail
service.stop();
System.out.println("Driver quit");
}
// @AfterTest
// public synchronized void teardown() {
// if (driver != null)
//// driver.quit();
// service.stop();
// }
}

Enter code here...org.openqa.selenium.WebDriverException: org.openqa.selenium.WebDriverException: cannot forward the request 127.0.0.1:5000 failed to respond
Also im a bit confused is it really necessary to use selenium grid while performing parallel test
public class BaseSetup {
protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();
private SeleniumServer hub;
@Parameters({"deviceName","platformVersion","udid","URL_","Sport","deviceId","sysPort","bootStrap","wdaPort","path"})
@BeforeMethod(alwaysRun = true)
public void setUp (String deviceName, String platformVersion, String udid, String URL_, String Sport, String deviceId, String sysPort, String bootStrap, String wdaPort, String path) throws Exception {
System.out.println("Driver Is Initiated");
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
dc.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, sysPort);
dc.setCapability(MobileCapabilityType.UDID,udid);
dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2"); // Make the test fail after first tear down "BROWSER_TIMEOUT"
dc.setCapability("appium:uiautomator2ServerInstallTimeout", "6000");
// Application setup
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.sarajevo.food.dictionary");
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.sfdmobile.MainActivity");
// dc.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.sfdmobile.MainActivity");
dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,"true");
dc.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
.withArgument(Arg.ADDRESS,URL_)
.withArgument(Arg.PORT,Sport)
.withArgument(Arg.CALLBACKPORT,Sport)
.withArgument(Arg.WDALOCALPORT,wdaPort)
.withArgument(Arg.BootstrapPort,bootStrap)
// .withArgument(Arg.NODECONFIG,path)
.withArgument(Arg.SESSIONOVERRIDE));
service.start();
// driver = new AndroidDriver (new URL("http://localhost:4444/wd/hub"), dc);
driver = new AndroidDriver (new URL("http://"+URL_+":"+Sport+"/wd/hub"), dc);
@AfterMethod
public void tearDown() throws InterruptedException {
if (driver != null)
// TimeUnit.SECONDS.sleep(2);
Also im a bit confused is it really necessary to use selenium grid while performing parallel test
cuz actually i tried to run test without selenium grid at all parallel and it works fine used code below
public class BaseSetup {
protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();
private SeleniumServer hub;
@Parameters({"deviceName","platformVersion","udid","URL_","Sport","deviceId","sysPort","bootStrap","wdaPort","path"})
@BeforeMethod(alwaysRun = true)
public void setUp (String deviceName, String platformVersion, String udid, String URL_, String Sport, String deviceId, String sysPort, String bootStrap, String wdaPort, String path) throws Exception {
System.out.println("Driver Is Initiated");
DesiredCapabilities dc = new DesiredCapabilities();
// Mobile setup
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
dc.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, sysPort);
dc.setCapability(MobileCapabilityType.UDID,udid);
dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2"); // Make the test fail after first tear down "BROWSER_TIMEOUT"
dc.setCapability("appium:uiautomator2ServerInstallTimeout", "6000");
// Application setup
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.sarajevo.food.dictionary");
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.sfdmobile.MainActivity");
// dc.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.sfdmobile.MainActivity");
dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,"true");
dc.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
// Driver configuration
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
.withArgument(Arg.ADDRESS,URL_)
.withArgument(Arg.PORT,Sport)
.withArgument(Arg.CALLBACKPORT,Sport)
.withArgument(Arg.WDALOCALPORT,wdaPort)
.withArgument(Arg.BootstrapPort,bootStrap)
// .withArgument(Arg.NODECONFIG,path)
.withArgument(Arg.SESSIONOVERRIDE));
service.start();
// driver = new AndroidDriver (new URL("http://localhost:4444/wd/hub"), dc);
driver = new AndroidDriver (new URL("http://"+URL_+":"+Sport+"/wd/hub"), dc);
@AfterMethod
public void tearDown() throws InterruptedException {
if (driver != null)
// TimeUnit.SECONDS.sleep(2);
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ebc5a248-0c11-4dc0-bd5d-dbb2c4ed6ca2%40gmail.com.
Also im a bit confused is it really necessary to use selenium grid while performing parallel test
cuz actually i tried to run test without selenium grid at all parallel and it works fine used code below
public class BaseSetup {
protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();
private SeleniumServer hub;
@Parameters({"deviceName","platformVersion","udid","URL_","Sport","deviceId","sysPort","bootStrap","wdaPort","path"})
@BeforeMethod(alwaysRun = true)
public void setUp (String deviceName, String platformVersion, String udid, String URL_, String Sport, String deviceId, String sysPort, String bootStrap, String wdaPort, String path) throws Exception {
System.out.println("Driver Is Initiated");
DesiredCapabilities dc = new DesiredCapabilities();
// Mobile setup
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
dc.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, sysPort);
dc.setCapability(MobileCapabilityType.UDID,udid);
dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2"); // Make the test fail after first tear down "BROWSER_TIMEOUT"
dc.setCapability("appium:uiautomator2ServerInstallTimeout", "6000");
// Application setup
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.sarajevo.food.dictionary");
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.sfdmobile.MainActivity");
// dc.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.sfdmobile.MainActivity");
dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,"true");
dc.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
// Driver configuration
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(new File("/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js"))
.withArgument(Arg.ADDRESS,URL_)
.withArgument(Arg.PORT,Sport)
.withArgument(Arg.CALLBACKPORT,Sport)
.withArgument(Arg.WDALOCALPORT,wdaPort)
.withArgument(Arg.BootstrapPort,bootStrap)
// .withArgument(Arg.NODECONFIG,path)
.withArgument(Arg.SESSIONOVERRIDE));
service.start();
// driver = new AndroidDriver (new URL("http://localhost:4444/wd/hub"), dc);
driver = new AndroidDriver (new URL("http://"+URL_+":"+Sport+"/wd/hub"), dc);
@AfterMethod
public void tearDown() throws InterruptedException {
if (driver != null)
// TimeUnit.SECONDS.sleep(2);
// driver.quit(); //will lead to unexpected behaviour during teardown, some test will fail
service.stop();
System.out.println("Driver quit");
}
}
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d3769054-935f-424e-b85e-b4c0c13b502f%40googlegroups.com.
Sravan,
>>>> If you're using grid for just parallel execution, You need to think about it.
What is wrong in leveraging the Selenium Grid just for parallel executions? Can you please help elaborate/clarify what pitfalls you see with that ?
Supporting parallel execution and thus bringing down the overall execution time of tests is also one of the use cases that the Grid was built for.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.com/
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMcQ0vm1sETHszyypZSRYsf2LhyLV7XYr5dM3QJBd9U2MFu-BQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/F2B67A41-3F17-43A3-B375-A179A2C33A73%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ca25cd77-119b-4689-8716-76d86a6c7e11%40gmail.com.