Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

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




<img src="webkit-fake-url://db030537-8f4c-458a-bbcd-6a27d1a9842d/image.tiff">


--
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝
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/

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:
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.







--
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 [hidden email].
To post to this group, send email to [hidden email].
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmAyXc91oiN4Jg%2By0XySSuWLVmrPZ980N3g5KmwEcNBoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Vikram
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

On Friday, April 29, 2016 at 6:21:40 AM UTC+2, Krishnan wrote:
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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="B2GZAPDfAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">neversto...@...> wrote:
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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.







--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="B2GZAPDfAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="B2GZAPDfAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝
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/

On Tue, Dec 20, 2016 at 7:38 PM, Vikram <[hidden email]> wrote:
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

On Friday, April 29, 2016 at 6:21:40 AM UTC+2, Krishnan wrote:
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/

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:
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.







--
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 [hidden email].
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmi5nE3mBaYb51yWh35b1TQ%3DbeBMTLwdSLENuPbi-kefw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Vikram
Hey Krishnan,

Thanks for detailed clarifications.

Regards,
Vikram

On Wednesday, December 21, 2016 at 4:08:04 AM UTC+1, Krishnan wrote:
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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Tue, Dec 20, 2016 at 7:38 PM, Vikram <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="7zytIoJGEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vikra...@...> wrote:
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

On Friday, April 29, 2016 at 6:21:40 AM UTC+2, Krishnan wrote:
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", "<a href="http://localhost:4444/grid/register" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:
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", "<a href="http://localhost:4444/grid/register" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.







--
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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="7zytIoJGEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="7zytIoJGEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/0ef52aa8-1ae4-427f-809d-452fb826d0be%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/21b41557-5715-455a-acd2-e1a0048f933d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Sai Kiran-2
In reply to this post by Darin Duphorn
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

On Wednesday, April 27, 2016 at 2:28:57 AM UTC-4, Darin Duphorn wrote:
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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.







--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c99b88c1-25d3-4c99-bcdb-96cc90d0cc8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝

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/

 

From: <[hidden email]> on behalf of Sai Kiran <[hidden email]>
Reply-To: <[hidden email]>
Date: Sunday, June 4, 2017 at 5:17 PM
To: Selenium Users <[hidden email]>
Subject: [selenium-users] Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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


On Wednesday, April 27, 2016 at 2:28:57 AM UTC-4, Darin Duphorn wrote:

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.

 

 

 

 

 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c99b88c1-25d3-4c99-bcdb-96cc90d0cc8c%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/21B73F2C-2882-405D-8F19-7B92C3B2068A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma
In reply to this post by ⇜Krishnan Mahadevan⇝
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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:
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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="B2GZAPDfAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">neversto...@...> wrote:
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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.







--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="B2GZAPDfAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="B2GZAPDfAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <<a href="javascript:" target="_blank">neversto...@...> wrote:

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.

 

 

 

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 <a href="javascript:" target="_blank">selenium-user...@....
To post to this group, send email to <a href="javascript:" target="_blank">seleniu...@....
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/38B86AA9-51E7-4E70-9AB7-0ADA6C27B601%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma

Thanks a lot Krishnan ! 

On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com> on behalf of Rajiv Sharma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rajiv....@...>
Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.

 

 

 

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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/71d97179-75db-4674-83e1-a5c447b77fd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma
In reply to this post by ⇜Krishnan Mahadevan⇝
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>


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com> on behalf of Rajiv Sharma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rajiv....@...>
Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.

 

 

 

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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="gDNjW_qyBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝

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.

 

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, October 14, 2017 at 10:43 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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>

 


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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: <<a href="javascript:" target="_blank">seleniu...@...> on behalf of Rajiv Sharma <<a href="javascript:" target="_blank">rajiv....@...>
Reply-To: <<a href="javascript:" target="_blank">seleniu...@...>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <<a href="javascript:" target="_blank">seleniu...@...>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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.

 

 

 

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 [hidden email].
To post to this group, send email to [hidden email].
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 <a href="javascript:" target="_blank">selenium-user...@....
To post to this group, send email to <a href="javascript:" target="_blank">seleniu...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0194B4C3-1A34-4000-861C-D805D30C394B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma
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

On Saturday, October 14, 2017 at 11:01:34 AM UTC+5:30, Krishnan Mahadevan wrote:

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.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Z95qr7Q1AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com> on behalf of Rajiv Sharma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Z95qr7Q1AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rajiv....@...>
Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Z95qr7Q1AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Date: Saturday, October 14, 2017 at 10:43 AM
To: Selenium Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Z95qr7Q1AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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>

 


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.

 

 

 

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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Z95qr7Q1AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Z95qr7Q1AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝

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

 

 

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 24, 2017 at 11:44 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Saturday, October 14, 2017 at 11:01:34 AM UTC+5:30, Krishnan Mahadevan wrote:

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.

 

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: <<a href="javascript:" target="_blank">seleniu...@...> on behalf of Rajiv Sharma <<a href="javascript:" target="_blank">rajiv....@...>
Reply-To: <<a href="javascript:" target="_blank">seleniu...@...>
Date: Saturday, October 14, 2017 at 10:43 AM
To: Selenium Users <<a href="javascript:" target="_blank">seleniu...@...>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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>

 


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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.

 

 

 

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 [hidden email].
To post to this group, send email to [hidden email].
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%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 <a href="javascript:" target="_blank">selenium-user...@....
To post to this group, send email to <a href="javascript:" target="_blank">seleniu...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8B27B9D3-A68E-45DD-A956-97903F5390A2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma
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);
driver.get("https://www.google.co.in/");
}

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


On Tuesday, October 24, 2017 at 1:15:13 PM UTC+5:30, Krishnan Mahadevan wrote:

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 <a href="http://localhost:9515/session" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;">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"}}'   <a href="http://localhost:9515/session" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;">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}}

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="T8iEp3ZvBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com> on behalf of Rajiv Sharma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="T8iEp3ZvBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rajiv....@...>
Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="T8iEp3ZvBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Date: Tuesday, October 24, 2017 at 11:44 AM
To: Selenium Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="T8iEp3ZvBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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("<a href="http://localhost:4444/wd/hub" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">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', <a href="http://os.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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("<a href="http://localhost:4444/wd/hub" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">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', <a href="http://os.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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 <a href="http://localhost:9999/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9999%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF4A59MCUQJgg_ivqcbCXjQwF3Ekg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9999%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF4A59MCUQJgg_ivqcbCXjQwF3Ekg&#39;;return true;">http://localhost:9999/grid/register -port 9957 -browser "browserName=chrome, maxInstances=10, platform=ANY, selenium Protocol=WebDriver"

 

 

--

Rajiv

On Saturday, October 14, 2017 at 11:01:34 AM UTC+5:30, Krishnan Mahadevan wrote:

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.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, October 14, 2017 at 10:43 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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>

 


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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", "<a href="http://localhost:4444/grid/register" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.

 

 

 

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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="T8iEp3ZvBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="T8iEp3ZvBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5d31e596-6858-4925-a0db-e0150b1d34fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

hubConfig.json (367 bytes) Download Attachment
nodeconfig.json (667 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma
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

On Wednesday, October 25, 2017 at 11:41:47 AM UTC+5:30, Rajiv Sharma wrote:
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("<a href="http://localhost:4444/wd/hub" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">http://localhost:4444/wd/hub"), cap);
driver.get("<a href="https://www.google.co.in/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.co.in/&#39;;return true;" onclick="this.href=&#39;https://www.google.co.in/&#39;;return true;">https://www.google.co.in/");
}

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', <a href="http://os.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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


On Tuesday, October 24, 2017 at 1:15:13 PM UTC+5:30, Krishnan Mahadevan wrote:

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 <a href="http://localhost:9515/session" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;">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"}}'   <a href="http://localhost:9515/session" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;">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}}

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 24, 2017 at 11:44 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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("<a href="http://localhost:4444/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">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', <a href="http://os.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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("<a href="http://localhost:4444/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">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', <a href="http://os.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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 <a href="http://localhost:9999/grid/register" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9999%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF4A59MCUQJgg_ivqcbCXjQwF3Ekg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9999%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF4A59MCUQJgg_ivqcbCXjQwF3Ekg&#39;;return true;">http://localhost:9999/grid/register -port 9957 -browser "browserName=chrome, maxInstances=10, platform=ANY, selenium Protocol=WebDriver"

 

 

--

Rajiv

On Saturday, October 14, 2017 at 11:01:34 AM UTC+5:30, Krishnan Mahadevan wrote:

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.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, October 14, 2017 at 10:43 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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>

 


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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 @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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", "<a href="http://localhost:4444/grid/register" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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 @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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", "<a href="http://localhost:4444/grid/register" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fgrid%2Fregister\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHiH156dSkwjcK-fQ41tfSxPDC1cQ&#39;;return true;">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.

 

 

 

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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/71082bc6-41a4-440b-8b8c-66168e204424%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/59165c65-5f15-4f8a-b0b8-7bd16383be31%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/0bc81ad7-2927-4ea5-872e-1ae09983a0ee%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/2a99bf56-18c6-49fe-b300-8220cf134de5%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/af561a90-4277-45b2-b1c1-97e0b8d2cddb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

⇜Krishnan Mahadevan⇝

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 ?


On Thu, Oct 26, 2017, 10:11 Rajiv Sharma <[hidden email]> wrote:
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

On Wednesday, October 25, 2017 at 11:41:47 AM UTC+5:30, Rajiv Sharma wrote:
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


On Tuesday, October 24, 2017 at 1:15:13 PM UTC+5:30, Krishnan Mahadevan wrote:

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

 

 

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 24, 2017 at 11:44 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Saturday, October 14, 2017 at 11:01:34 AM UTC+5:30, Krishnan Mahadevan wrote:

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.

 

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, October 14, 2017 at 10:43 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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>

 


On Wednesday, October 11, 2017 at 9:41:16 AM UTC+5:30, Krishnan Mahadevan wrote:

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: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 10, 2017 at 11:59 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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

On Friday, April 29, 2016 at 9:51:40 AM UTC+5:30, Krishnan Mahadevan wrote:

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/

 

On Tue, Apr 26, 2016 at 10:14 PM, Darin Duphorn <[hidden email]> wrote:

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(<span style="color:#3933ff"

--

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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmFWK5BNMTBdByKPHsnk_a0gxr5gybdpbxM22T6Cp1VvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

Rajiv Sharma
Thanks Krishnana !!

yes, I will add in PATH variable.

---
Rajiv

On Thursday, October 26, 2017 at 10:16:44 AM UTC+5:30, Krishnan Mahadevan wrote:

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 ?


On Thu, Oct 26, 2017, 10:11 Rajiv Sharma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="m09X7FobAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rajiv....@...> wrote:
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://<a href="http://192.168.56.1:4444" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.56.1%3A4444\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHMupO8vAHhRPoJb_RtepnQkVVdlg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.56.1%3A4444\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHMupO8vAHhRPoJb_RtepnQkVVdlg&#39;;return true;">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

On Wednesday, October 25, 2017 at 11:41:47 AM UTC+5:30, Rajiv Sharma wrote:
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("<a href="http://localhost:4444/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">http://localhost:4444/wd/hub"), cap);
driver.get("<a href="https://www.google.co.in/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.co.in/&#39;;return true;" onclick="this.href=&#39;https://www.google.co.in/&#39;;return true;">https://www.google.co.in/");
}

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', <a href="http://os.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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


On Tuesday, October 24, 2017 at 1:15:13 PM UTC+5:30, Krishnan Mahadevan wrote:

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 <a href="http://localhost:9515/session" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;">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"}}'   <a href="http://localhost:9515/session" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A9515%2Fsession\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHN2j2VKtYQ7QftNwN0WijdjEdVfw&#39;;return true;">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}}

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, October 24, 2017 at 11:44 AM
To: Selenium Users <[hidden email]>
Subject: Re: [selenium-users] Programmatically open Selenium Hub and Node - ErrorDefaultRemoteProxy unknown version

 

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("<a href="http://localhost:4444/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">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', <a href="http://os.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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("<a href="http://localhost:4444/wd/hub" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A4444%2Fwd%2Fhub\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGL7ghOGmWpqo93CZkfCgX3jjpVBg&#39;;return true;">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', <a href="http://os.name" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fos.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEBq5pahnbxzpNVLfaFeTDcQCtrYg&#39;;return true;">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(