Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

1,926 views
Skip to first unread message

Darin Duphorn

unread,
Apr 27, 2016, 2:28:57 AM4/27/16
to Selenium Users
Team,

I'm trying to programmatically start Selenium Hub and Node, but I'm having a difficult time passing the Version.  I've tried to pass through nodeConfiguration, and Capabilities, but I was not successful.

Below is the code that I'm using, in which I found most of it online. (Thanks for that everyone)

                    

                    String strIP = "Your IP";

                    //Launch Selenium Hub

        GridHubConfiguration config = new GridHubConfiguration();

        config.setTimeout(30000000);

                config.setPort(4444);

                Hub hub = new Hub(config);

                hub.start();

    

                RegistrationRequest req = new RegistrationRequest();

                req.setRole(GridRole.NODE);

                

                Map<String, Object> nodeConfiguration = new HashMap<String, Object>();

                nodeConfiguration.put(RegistrationRequest.PROXY_CLASS, "org.openqa.grid.selenium.proxy.DefaultRemoteProxy");

                nodeConfiguration.put(RegistrationRequest.MAX_SESSION, 5);

                nodeConfiguration.put(RegistrationRequest.PORT, 5555);

                nodeConfiguration.put(RegistrationRequest.HOST, 4444);

                nodeConfiguration.put(RegistrationRequest.AUTO_REGISTER, true);

                nodeConfiguration.put(RegistrationRequest.REGISTER_CYCLE, 5000);

                nodeConfiguration.put(RegistrationRequest.HUB_HOST, "localhost");

                nodeConfiguration.put(RegistrationRequest.HUB_PORT, 4444);

                nodeConfiguration.put("remoteHost", "http://"+strIP+":5555");

                nodeConfiguration.put("url", "http://"+strIP+":5555");

                nodeConfiguration.put("role", "node");

                nodeConfiguration.put("hub", "http://localhost:4444/grid/register");

                nodeConfiguration.put("Dwebdriver.chrome.driver=chromedriver", "");

                URL remoteURL = new URL("http://"+strIP+":5555");

                nodeConfiguration.put(RegistrationRequest.REMOTE_HOST, remoteURL);

                req.setConfiguration(nodeConfiguration);

                

                DesiredCapabilities capabilities2 = DesiredCapabilities.chrome();

                    capabilities2.setCapability("browserName","chrome");

                    capabilities2.setCapability("platform", "MAC");

                    capabilities2.setCapability("ensureCleanSession", "true");

                    capabilities2.setCapability("maxInstances",5);

                    

                req.addDesiredCapability(capabilities2);

                SelfRegisteringRemote remote = new SelfRegisteringRemote(req);

                try

                {

                remote.startRemoteServer();

                }

                catch (Exception f)

            {

                System.out.println(f); //Fails here org.openqa.grid.common.exception.GridConfigurationException: no server set to register to the hub            

                    }

                remote.startRegistrationProcess(); //I Let this run

                System.out.println("Stop Here"); //Break point Here


When this code runs, and I open my browser to localhost:4444/grid/console# it displays the below.


Any ides how I can pass the version? Or any idea why it says "no server set to register to the hub"?


Thanks for any help you can provide.







⇜Krishnan Mahadevan⇝

unread,
Apr 29, 2016, 12:21:40 AM4/29/16
to Selenium Users
Darin,
The below code should help you get started:
import org.openqa.grid.common.GridRole;
import org.openqa.grid.common.RegistrationRequest;
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.server.SeleniumServer;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

public class HubViaCode {
public static void main(String[] args) throws Exception {
String strIP = "localhost";

GridHubConfiguration config = new GridHubConfiguration();
config.setTimeout(30000000);
config.setPort(4444);
        config.setHost(strIP);

Hub hub = new Hub(config);
hub.start();
RegistrationRequest req = new RegistrationRequest();
req.setRole(GridRole.NODE);
        Map<String, Object> nodeConfiguration = new HashMap<>();
nodeConfiguration.put(RegistrationRequest.PROXY_CLASS, DefaultRemoteProxy.class.getName());

nodeConfiguration.put(RegistrationRequest.MAX_SESSION, 5);
nodeConfiguration.put(RegistrationRequest.PORT, 5555);
nodeConfiguration.put(RegistrationRequest.HOST, 4444);
nodeConfiguration.put(RegistrationRequest.AUTO_REGISTER, true);
nodeConfiguration.put(RegistrationRequest.REGISTER_CYCLE, 5000);
nodeConfiguration.put(RegistrationRequest.HUB_HOST, "localhost");
nodeConfiguration.put(RegistrationRequest.HUB_PORT, 4444);
        nodeConfiguration.put("remoteHost", "http://" + strIP + ":5555");
nodeConfiguration.put("url", "http://" + strIP + ":5555");

nodeConfiguration.put("role", "node");
nodeConfiguration.put("hub", "http://localhost:4444/grid/register");
        URL remoteURL = new URL("http://" + strIP + ":5555");
        nodeConfiguration.put(RegistrationRequest.REMOTE_HOST, remoteURL.toExternalForm());

req.setConfiguration(nodeConfiguration);
DesiredCapabilities capabilities2 = DesiredCapabilities.chrome();
capabilities2.setCapability("browserName", "chrome");
capabilities2.setCapability("platform", "MAC");
capabilities2.setCapability("ensureCleanSession", "true");
capabilities2.setCapability("maxInstances", 5);
req.addDesiredCapability(capabilities2);
SelfRegisteringRemote remote = new SelfRegisteringRemote(req);
        remote.setRemoteServer(new SeleniumServer(req.getConfiguration()));
remote.startRemoteServer();
remote.startRegistrationProcess();
Thread.currentThread().join();
}
}

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.wordpress.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/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vikram

unread,
Dec 20, 2016, 9:08:56 AM12/20/16
to Selenium Users
Hey Krishnan,

Thanks for sharing below code, it's working fine.

But I didn't get the step  "Thread.currentThread().join();"

why is this needed ?

Thanks & Regards,
Vikram

⇜Krishnan Mahadevan⇝

unread,
Dec 20, 2016, 10:08:04 PM12/20/16
to Selenium Users
Vikram,
I used to ensure that the main thread waits for any other threads within the Hub/Node logic to run to completion.If you don't use it, I guess the main method will run to completion and exit which I didn't want.

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.wordpress.com/

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%40googlegroups.com.

Vikram

unread,
Dec 22, 2016, 6:09:25 AM12/22/16
to Selenium Users
Hey Krishnan,

Thanks for detailed clarifications.

Regards,
Vikram

Sai Kiran

unread,
Jun 4, 2017, 10:42:27 PM6/4/17
to Selenium Users
Dear Selenium Experts

I am kind of new to Selenium Grid. I am using selenium-server-standalone-3.4.0.jar and 
I am able to start HUB programatically, however I am unable to register nodes programatically, all of nodes are different windows computers in the same Network. 
 
 HUB is running on IP 192.168.1.10
 Nodes are at 
  • 192.168.1.11
  • 192.168.1.12
  • 192.168.1.13
  • 192.168.1.14
Could some one please guide me if there is a way to Register nodes from HUB computer?

Sai

Krishnan Mahadevan

unread,
Jun 4, 2017, 10:47:01 PM6/4/17
to seleniu...@googlegroups.com

Sai Kiran,

 

You cannot programmatically wire in node to a hub when the machines on which they run are different.

 

When you wire in a node to a hub via code, it would be done in the same JVM.

 

So you would need to resort to the manual way of registering nodes to hub as detailed in the wiki page of Grid2.

 

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.wordpress.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.

Rajiv Sharma

unread,
Oct 10, 2017, 2:29:37 AM10/10/17
to Selenium Users
Hi Krishnan,

seems in 3.6.0 selenium webdriver version below code is not working. Can you please suggest, how we can register hub and node pragmatically in 3.6.0?

Thanks,
Rajiv

Krishnan Mahadevan

unread,
Oct 11, 2017, 12:11:16 AM10/11/17
to seleniu...@googlegroups.com

Rajiv,

 

I think, going forward, you should start the hub and the node as shown below :

 

public static void main(String[] args) throws

Exception {
    String hubHost =
"localhost";
    String hubPort =
"4444";
    String[] gridArgs =
new String[] {"-role", "hub", "-timeout", "30000000", "-host", hubHost, "-port", hubPort};
    GridLauncherV3.main(gridArgs);
    String[] nodeArgs =
new String[] {"-role", "node", "-hub", String.format("http://%s:%s/grid/register", hubHost, hubPort),
   
"-port", "5555"};
    GridLauncherV3.main(nodeArgs);
    Thread.currentThread().join();
}

 

You can always improvise this, by creating the configuration files (if required) via your code. But starting the Hub and the mode via the main() method is a lot more stable, because that’s the only actual way in which people are expected to start the hub and the node and that’s why the arguments hardly change. The internals of Selenium can change.

 

If you are still keen on using the APIs for starting, then you can take a look at the internals of GridLauncherV3.main() to understand how to set various things.

 

 

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.wordpress.com/

 

From: <seleniu...@googlegroups.com> on behalf of Rajiv Sharma <rajiv....@gmail.com>


Reply-To: <seleniu...@googlegroups.com>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <seleniu...@googlegroups.com>

Error! Filename not specified.

 

 

--
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/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.

Rajiv Sharma

unread,
Oct 11, 2017, 12:38:16 AM10/11/17
to Selenium Users

Thanks a lot Krishnan ! 

Rajiv Sharma

unread,
Oct 14, 2017, 1:13:23 AM10/14/17
to Selenium Users
Hi Krishnan,

while using blow code i am getting below error -:

10:38:27.033 INFO - Driver class not found: com.opera.core.systems.OperaDriver
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.toImmutableList()Ljava/util/stream/Collector;
at org.openqa.selenium.remote.server.DefaultDriverFactory.<clinit>(DefaultDriverFactory.java:56)
at org.openqa.selenium.remote.server.SeleniumServer.boot(SeleniumServer.java:133)
at org.openqa.grid.internal.utils.SelfRegisteringRemote.startRemoteServer(SelfRegisteringRemote.java:135)
at org.openqa.grid.selenium.GridLauncherV3$3.launch(GridLauncherV3.java:288)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:99)
at selenium.grid.Scrolling.main(Scrolling.java:23)

I tried to add some below google dependency in pom but issue didn't resolve. Request you to help me on this issue.

 <dependency>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-compiler-javac-errorprone</artifactId>
          <version>2.8.1</version>
        </dependency>
        <!-- Override Guava to workaround issue google/error-prone#482; must come before error_prone_core -->
        <dependency>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
          <version>20.0</version>
        </dependency>
        <!-- override plexus-compiler-javac-errorprone's dependency on
             Error Prone with the latest version -->
        <dependency>
          <groupId>com.google.errorprone</groupId>
          <artifactId>error_prone_core</artifactId>
          <version>2.0.14</version>
        </dependency>

Krishnan Mahadevan

unread,
Oct 14, 2017, 1:31:34 AM10/14/17
to seleniu...@googlegroups.com

Rajiv,

Not sure, what version of Selenium are you working with. Assuming that you are using Selenium 3.6.0 you should be using “com.google.guava:guava:jar:23.0”.

But it looks like you are explicitly resolving to some other version of guava libraries which explains the error that you are seeing.

Rajiv Sharma

unread,
Oct 24, 2017, 2:13:47 AM10/24/17
to Selenium Users
Hi Krishnan,

Its working fine now after deleting ..m2 folder. Thanks for your help!

Still, I'm facing an issue in opening browsers[Chrome and IE]  while running hub/node problematically. Below code getting exception -:'


DesiredCapabilities cap = DesiredCapabilities.chrome();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);

---------------
org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'RAJIV-PC', ip: '192.168.42.119', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_73'
Driver info: driver.version: unknown
Command duration or timeout: 91 milliseconds
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
at test.thread.GridHub.test(GridHub.java:46)
----------------

If i set browser version then also getting exception -:

DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setVersion("63.0.3");

WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);

------------------
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities [{browserName=chrome, platformName=ANY, version=63.0.3, platform=ANY}]
Command duration or timeout: 80 milliseconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'RAJIV-PC', ip: '192.168.42.119', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_73'
Driver info: driver.version: RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
at test.thread.GridHub.test(GridHub.java:48)

---------------------------------------------------------

In above  both cases I have tried adding 

System.setProperty("webdriver.chrome.driver", "D:\\JavaJar\\chromedriver_win32\\chromedriver.exe");

also, in node.config file set capability chrome_binary & exe path. but didn't get success.

-------------------------------------------------------------------------------------------------------------------------------------------------------

on the other hand with command line. its working fine-: 

Start Hub command -: java -jar selenium-server-standalone-3.6.0.jar -role hub -port 5555

Start Node command -: java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.6.0.jar -role node -hub http://localhost:9999/grid/register -port 9957 -browser "browserName=chrome, maxInstances=10, platform=ANY, selenium Protocol=WebDriver"


--
Rajiv

Krishnan Mahadevan

unread,
Oct 24, 2017, 3:45:13 AM10/24/17
to seleniu...@googlegroups.com

For the first scenario, I guess its due to a bad/wrong chromedriver binary version.

 

For the second scenario, it’s a valid error. The hub is basically saying that it doesn’t have any nodes that can service xx.yy version of chrome.

 

Debugging steps that you can follow:

 

  1. Make sure you are using the latest chromedriver version.
  2. Open up a command prompt and type chromedriver.
  3. From another command prompt or using postman, trigger a post to the endpoint http://localhost:9515/session (The port can be obtained from step (2))

 

You should see something like this :

 

 

$ chromedriver

Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 9515

Only local connections are allowed.

 

$ curl -i -H "Accept: application/json" -X POST -d '{"desiredCapabilities":{"browserName":"chrome"}}'   http://localhost:9515/session

HTTP/1.1 200 OK

Content-Length:816

Content-Type:application/json; charset=utf-8

Connection:close

 

{"sessionId":"820e5299fe7d0d8afeaef475a8ad5a91","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2)","userDataDir":"/var/folders/mj/81r6v7nn5lqgqgtfl18spfpw0000gn/T/.org.chromium.Chromium.2OnOxX"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Mac OS X","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"61.0.3163.100","webStorageEnabled":true}}

Rajiv Sharma

unread,
Oct 25, 2017, 2:11:47 AM10/25/17
to Selenium Users
Hi Krishnan,

I am using latest chrome driver version. But still not able to open the chrome browser -:

My steps as below :

1. Registering hub and nodes through main method -

                  String[] gridArgs = new String[] { "-role",
"hub","-hubConfig","D:\\workspace-new\\thread\\hubConfig.json" };

GridLauncherV3.main(gridArgs);

                  String[] nodeArgs = new String[] { "-role", "node",
"-nodeConfig","D:\\workspace-new\\thread\\nodeconfig.json"};

                GridLauncherV3.main(nodeArgs);
               Thread.currentThread().join();


Attached is hubConfig.json file.

Attached is nodeConfig.json file.

2. Created a TestNG anotated test -:
@Test
public void test() throws MalformedURLException {
                
                 //tried using and commenting this property

System.setProperty("webdriver.chrome.driver", "D:\\JavaJar\\chromedriver_win32\\chromedriver.exe");

DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setVersion("2.33");
cap.setPlatform(Platform.WINDOWS);

WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);
}

3. Exception on Hub -:

11:20:06.778 INFO - Mismatched capabilities. Creating a synthetic w3c capability.
11:20:06.778 INFO - Got a request to create a new session: Capabilities [{browserName=chrome, platformName=WINDOWS, version=2.33, platform=WINDOWS}]
11:20:06.778 INFO - Error forwarding the new session cannot find : Capabilities [{browserName=chrome, platformName=WINDOWS, version=2.33, platform=WINDOWS}]
org.openqa.grid.common.exception.CapabilityNotPresentOnTheGridException: cannot find : Capabilities [{browserName=chrome, platformName=WINDOWS, version=2.33, platform=WINDOWS}]
at org.openqa.grid.internal.ProxySet.verifyAbilityToHandleDesiredCapabilities(ProxySet.java:180)
at org.openqa.grid.internal.Registry.addNewSessionRequest(Registry.java:224)
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:103)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:84)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

4. Exception on test -:

org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities [{browserName=chrome, platformName=WINDOWS, version=2.33, platform=WINDOWS}]
Command duration or timeout: 78 milliseconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'RAJIV-PC', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_73'
Driver info: driver.version: RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)


While CMD getting below result -:

D:\seleniumServer>chromedriver
Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on
port 9515
Only local connections are allowed.

Please help me and is there any way to check capabilities on node? so the same capabilities can we send.

--
Rajiv
hubConfig.json
nodeconfig.json

Rajiv Sharma

unread,
Oct 26, 2017, 12:40:51 AM10/26/17
to Selenium Users
Hi Krishnan,

Now I am able to open the browser. I did following changes -:

Set chrome binary property in main methods before starting node - 

 
 public static void main(String[] args) throws Exception {



 
String[] gridArgs = new String[] { "-role",

 
"hub","-hubConfig","D:\\workspace-new\\thread\\hubConfig.json" };
 
GridLauncherV3.main(gridArgs);
 
 System.setProperty("webdriver.chrome.driver", "D:\\JavaJar\\chromedriver_win32\\chromedriver.exe");



 
 
String[] nodeArgs = new String[] { "-role", "node",

 
"-nodeConfig","D:\\workspace-new\\thread\\nodeconfig.json"};


 
GridLauncherV3.main(nodeArgs);
 
Thread.currentThread().join();
 
}


And instead of localhost I used IP while initiating RemoteWebDriver 

 WebDriver driver = new RemoteWebDriver(new URL("http://192.168.56.1:4444/wd/hub"), DesiredCapabilities.chrome());


Can you suggest me how I can set chrome binary path from nodeConfig file? below path

System.setProperty("webdriver.chrome.driver", "D:\\JavaJar\\chromedriver_win32\\chromedriver.exe");

Thanks,
Rajiv

⇜Krishnan Mahadevan⇝

unread,
Oct 26, 2017, 12:46:44 AM10/26/17
to seleniu...@googlegroups.com

AFAIK it cannot be set via the node configuration file. Why wouldn't adding it to the PATH variable as a one time activity per machine not work for you ?


                    capabilities2.setCapability(<span style="color:#3933ff"

--

Rajiv Sharma

unread,
Oct 26, 2017, 1:08:36 AM10/26/17
to Selenium Users
Thanks Krishnana !!

yes, I will add in PATH variable.

---
Rajiv

shashank shekhar

unread,
Aug 14, 2018, 11:21:08 PM8/14/18
to Selenium Users
Hi @ Krishnan Mahadevan,

Please help me here.I am trying to setup a grid in appium so Starting hub and node  programmatically but getting below error.
org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities {app: C:\Users\Shashank.Shekhar\D..., deviceName: ANDROID, platformName: android}
My codes are as below.

public void startSeleniumHub() {
try {
// String strIP = "172.25.94.113";
String strIP = "localhost";

GridHubConfiguration config = new GridHubConfiguration();
config.newSessionWaitTimeout = 30000000;
config.host = strIP;
config.port = 4444;

hub = new Hub(config);

System.out.println("hub point");
hub.start();
System.out.println("Hub started");
if (isSeleniumHubRunning(10)) {
System.out.println("Selenium Grid is Running");
} else {
System.err.println("*** Selenium Grid is down");
}

} catch (Exception e) {
e.printStackTrace();
}
}


Then node config as below.

public boolean generate_node_config(int devicesCount) {
try {
int localCount = 1;
int portNumber = 4700;

while (localCount <= devicesCount) {
// ?? put sequence is not maintained
JSONObject capData = new JSONObject();
// capData.put("applicationName",
// "app-toyota-preprod-3.4.68.apk" + localCount);
// capData.put("browserName", "Android");
capData.put("platformName", "Android");
capData.put("maxInstances", 5);
// capData.put("deviceName",device);
System.out.println("device ids are " + deviceIds);

JSONArray capArray = new JSONArray();
capArray.add(capData);

/*
* RegistrationRequest req=new RegistrationRequest();
* req.setRole(GridRole.NODE);
*/

JSONObject parentData = new JSONObject();
JSONObject configData = new JSONObject();

configData.put("cleanUpCycle", 2000);
configData.put("AUTO_REGISTER", true);
configData.put("timeout", 30000);
configData.put("proxy", "org.openqa.grid.selenium.proxy.DefaultRemoteProxy");
// configData.put("url",Url);
configData.put("host", "localhost");
configData.put("port", portNumber);
configData.put("maxSession", 4);
configData.put("register", true);
configData.put("registerCycle", 5000);
configData.put("hubPort", 4444);
configData.put("hubHost", "localhost"); // ?? get this
configData.put("url", "http://localhost" + ":4700");
configData.put("remoteHost", "http://localhost" + ":4700");
configData.put("role", "node");

configData.put("hub", "http://localhost:4444/grid/register");

configData.put("Dwebdriver.chrome.driver=chromedriver", "");

URL remoteURL = new URL("http://localhost" + ":5555");

// value run time as IP shouldn't be STATIC
// configData.put("hubHost",
// InetAddress.getLocalHost().getHostAddress());

parentData.put("capabilities", capArray);
parentData.put("configuration", configData);

try (FileWriter file = new FileWriter(
projectDirectory + "/node_configs/device_" + localCount + ".json")) {
file.write(parentData.toJSONString());
System.out.println("Successfully Copied JSON Object to File...");
System.out.println("\nJSON Object: " + parentData);
} catch (Exception e) {
e.printStackTrace();
}

localCount++;
portNumber++;
}

System.out.println("generate_node_config is Success");
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
 And finally desired capability

public RemoteWebDriver getAndroidDriver() throws IOException {
File appDir = new File("src");
File app = new File(appDir, config.getProperty("app"));

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "ANDROID");
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "ANDROID");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
driver = new AndroidDriver<AndroidElement>(new URL("http://localhost:4444/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
return driver;
}

I am really struggling on this for past 4 days. Please advice whats wrong.Surprisingly the code runs fine in debug mode.I have attached logs for more details if required.

Thanks
Shashank
logs1.txt

Krishnan Mahadevan

unread,
Aug 16, 2018, 12:27:10 AM8/16/18
to seleniu...@googlegroups.com

Can you please explain/clarify what you are trying to do?

 

 

 

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.wordpress.com/

 

From: <seleniu...@googlegroups.com> on behalf of shashank shekhar <sshashan...@gmail.com>
Reply-To: <seleniu...@googlegroups.com>
Date: Wednesday, August 15, 2018 at 8:51 AM
To: Selenium Users <seleniu...@googlegroups.com>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

Hi @ Krishnan Mahadevan,

Error! Filename not specified.

 

 

--
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/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.

Krishnan Mahadevan

unread,
Aug 16, 2018, 12:30:42 AM8/16/18
to seleniu...@googlegroups.com

The only reason why your code works fine in debug mode but doesn’t work fine in the normal mode is because, you aren’t waiting till the node finishes its registration process and wires itself to the hub. Before that happens, you are routing tests to your hub and the hub is basically telling you “Hey, I don’t have any nodes at all with me”.

 

Merely adding a Thread.sleep(45 * 1000) [ Time can vary] after the node registration code should do the trick. There are sophisticated ways of making this an intelligent wait, but a simple sleep should do the trick.

 

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.wordpress.com/

 

shashank shekhar

unread,
Aug 16, 2018, 2:37:57 AM8/16/18
to seleniu...@googlegroups.com
Thanks Champ..It worked..:)

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.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-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/39E7112E-0431-40FD-8313-EAA23346B40C%40gmail.com.

shashank shekhar

unread,
Aug 22, 2018, 12:52:58 AM8/22/18
to seleniu...@googlegroups.com
Hi Krishnan,
Again the code is failing with same error even in the debug mode. The only difference is i tried running  same test case in 2 different devices parallely.
Kindly advice what could be the possible reason.

Regards
SHASHANK

shashank shekhar

unread,
Aug 22, 2018, 1:00:41 AM8/22/18
to seleniu...@googlegroups.com
Logs

log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
Aug 22, 2018 2:58:09 PM org.openqa.grid.web.servlet.handler.RequestHandler process
INFO: Got a request to create a new session: Capabilities {app: C:\Users\Shashank.Shekhar\D..., deviceName: MERCURY, platformName: android, resetKeyboard: true, unicodeKeyboard: true}
Aug 22, 2018 2:58:09 PM org.openqa.grid.web.servlet.handler.RequestHandler process
INFO: Error forwarding the new session Empty pool of VM for setup Capabilities {app: C:\Users\Shashank.Shekhar\D..., deviceName: MERCURY, platformName: android, resetKeyboard: true, unicodeKeyboard: true}
org.openqa.grid.common.exception.GridException: Empty pool of VM for setup Capabilities {app: C:\Users\Shashank.Shekhar\D..., deviceName: MERCURY, platformName: android, resetKeyboard: true, unicodeKeyboard: true}
at org.openqa.grid.internal.ProxySet.verifyAbilityToHandleDesiredCapabilities(ProxySet.java:146)
at org.openqa.grid.internal.DefaultGridRegistry.addNewSessionRequest(DefaultGridRegistry.java:216)
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:111)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:86)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:530)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102)
at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.lang.Thread.run(Thread.java:748)

shri

unread,
Sep 3, 2018, 12:34:21 PM9/3/18
to Selenium Users
Hello Krishnan/group,

I was trying to setup Jenkins with selenium Grid but on Centos Instances, Unfortunately I was unable to see lot of documentation for the purpose. I have installed the selenium plugin (which creates the selenium grid with existing jenkins master(hub) and jenkins slaves(nodes)) on jenkins. when i try to run test cases it gives the below errors on multiple instances.
I have Installed chromedriver and chrome binary on both node as well as hub but no luck. 
The chrome version I am using is 68 on node. on linux it is taking binary name as google-chrome unlike windows chrome.

Sep 02, 2018 11:48:19 AM org.openqa.selenium.remote.DesiredCapabilities chrome

INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally

  (unknown error: DevToolsActivePort file doesn't exist)

  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 3.10.0-693.11.6.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 237 milliseconds

Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'

System info: host: 'newnode-26.openstacklocal', ip: '10.0.0.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.11.6.el7.x86_64', java.version: '1.8.0_161'

Driver info: driver.version: unknown

Command duration or timeout: 537 milliseconds

       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)


-----------------------------------------------------------------------------------------------------------------------------

I have downloaded the selenium-server-standalone.jar latest and running the command.


 java -jar /var/lib/jenkins/selenium-server-standalone-3.12.0.jar -role hub -port 8070
21:26:16.789 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
21:26:16.792 INFO [GridLauncherV3$2.launch] - Launching Selenium Grid hub on port 8070
2018-09-02 21:26:17.175:INFO::main: Logging initialized @859ms to org.seleniumhq.jetty9.util.log.StdErrLog
21:26:17.378 INFO [Hub.start] - Selenium Grid hub is up and running
21:26:17.380 INFO [Hub.start] - Nodes should register to http://172.17.0.1:8070/grid/register/
21:26:17.380 INFO [Hub.start] - Clients should connect to http://172.17.0.1:8070/wd/hub
21:26:20.901 INFO [DefaultGridRegistry.add] - Registered a node http://10.0.0.55:3333


kindly help.

Krishnan Mahadevan

unread,
Sep 3, 2018, 12:40:28 PM9/3/18
to seleniu...@googlegroups.com

The errors that are shared by you, seem to suggest that you have a problem with your chromedriver+chrome setup.

 

Just to rule out chromedriver+chrome issues, please try doing the following on your unix machine and see if you notice a browser spin up.

 

  • Start the chromedriver binary.

 

22:05 $ chromedriver

Starting ChromeDriver 2.37.544337 (8c0344a12e552148c185f7d5117db1f28d6c9e85) on port 9515

Only local connections are allowed.

 

  • Triger a curl POST and check if you see the chrome browser opening up.

 

curl --header "Content-Type: application/json" --request POST --data '{"desiredCapabilities":{"browserName":"chrome"}}' http://localhost:9515/session

if you don’t see the browser open up, then it means you have a problem with your chromedriver + chrome combo.

 

 

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.wordpress.com/

 

shrinivas gangapuram

unread,
Sep 3, 2018, 1:58:03 PM9/3/18
to seleniu...@googlegroups.com
Thank you for the quickest reply. I will do the suggested.

shrinivas gangapuram

unread,
Sep 7, 2018, 9:39:46 PM9/7/18
to seleniu...@googlegroups.com
Hello Group/Krishnan,

I have the selenium grid configuration on linux environment. and the test cases are running successfully on jenkins. The only problem is that in place of the alphabets encoding it is showing some weird characters. Whenever test case fails we will get a screenshot, when i run from local it is perfect and when i am running from linux it is giving some alien characters in that screenshot. 

I have attached the screenshots one is errorfile which is with weird characters and other is right format. I am guessing its with character encoding but I need some help in fixing that. I am unable to resolve kindly help.
I am using chromedriver of X86_64 version 2.29.461571, google_chrome headless .google-chrome --version Google Chrome 68.0.3440.106.


errorfile.PNG
correctfile.PNG

akamel...@gmail.com

unread,
May 3, 2019, 5:11:42 AM5/3/19
to Selenium Users
hello Krishnan 

was wondering if there is anyway to start selenium grid programmatically within my code knowing that im starting appium server programmatically but i dont know whats the approach to do that for selenium grid
 
this is my baseSetup that i want to inject selenium grid with it 


Enter code here...public class BaseSetup   {

protected static AndroidDriver<MobileElement> driver = null;
protected AppiumDriverLocalService service;
public WebDriverWait wait;
private ThreadLocalDriver threadLocalDriver = new ThreadLocalDriver();


@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 MalformedURLException, InterruptedException {
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", "@sadA");



// Application setup
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "sad");
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "csad");
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);

// 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");
}

}




Message has been deleted

Krishnan Mahadevan

unread,
May 8, 2019, 9:53:32 AM5/8/19
to seleniu...@googlegroups.com
Prasanna,

Its not clear what you are asking for. Please clarify/elaborate your question.

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/

On 5/8/19, 7:20 PM, "Prasanna R" <seleniu...@googlegroups.com on behalf of prasann...@gmail.com> wrote:

where i need to give thread.sleep can u give sample code?

--
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/e03608f8-49db-4c18-a313-be62efe02afa%40googlegroups.com.

Prasanna R

unread,
May 8, 2019, 1:29:19 PM5/8/19
to Selenium Users
i am getting ErrorDefaultRemoteProxy unknown version. u replied in old messages as use thread.sleep but not understable where need to use. is it possible to give sample code

Krishnan Mahadevan

unread,
May 9, 2019, 1:42:12 AM5/9/19
to seleniu...@googlegroups.com
Use it after the node registration step is complete. I believe this thread has enough code that can be leveraged.

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/

On 5/8/19, 10:59 PM, "Prasanna R" <seleniu...@googlegroups.com on behalf of prasann...@gmail.com> wrote:

i am getting ErrorDefaultRemoteProxy unknown version. u replied in old messages as use thread.sleep but not understable where need to use. is it possible to give sample code

--
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/330dec9a-f6a6-4abb-9e42-78a56f627c88%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages