i am trying to start Hub in my local machine then registering webdriver different remotemachinesip in my local hub
while executing the code i am facing the following trouble , kindly help me on this
the code woks fine if i am registering my localhost webdriver to local Hub but for other machine's ip im facing the issue . let me know why it so?
Code logic Used
creating a hub
--------------
GridHubConfiguration gridHubConfig = new GridHubConfiguration();
gridHubConfig.setHost(hubHost);
gridHubConfig.setPort(hubPort);
myHub = new Hub(gridHubConfig);
myHub.start();
registering remote url using GridHubRegister
-----------------------------------------------------
nodeConfiguration.put(RegistrationRequest.PROXY_CLASS,"org.openqa.grid.selenium.proxy.WebDriverRemoteProxy");
remoteURL = new URL("http://" + myHost + ":" + portToRun + "/wd/hub");
adding remote url to hub and starting server
node = new SelfRegisteringRemote(registrationRequest);
node.startRemoteServer();
node.startRegistrationProcess();
the above codes are working fine
but when i try to start the selenium client with below code
its working when myHost ="localhost" but if i give myHost =remoteIP it giving error "refused"
remoteURL = new URL("http://" + myHost + ":" + portToRun + "/wd/hub");
webdriver = new RemoteWebDriver(remoteURL, capability);
webdriver.get("
http://www.google.com");
Error obtained
-------------------
Oct 20, 2011 7:10:42 PM org.openqa.jetty.http.HttpServer doStart
INFO: Version Jetty/5.1.x
Oct 20, 2011 7:10:42 PM org.openqa.jetty.util.FileResource <clinit>
INFO: Checking Resource aliases
Ports available : 5555
Oct 20, 2011 7:10:42 PM org.openqa.jetty.util.Container start
INFO: Started org.openqa.jetty.jetty.servlet.WebApplicationHandler@1e9247a
Oct 20, 2011 7:10:42 PM org.openqa.jetty.util.Container start
INFO: Started WebApplicationContext[/,/]
Oct 20, 2011 7:10:42 PM org.openqa.jetty.http.SocketListener start
INFO: Started SocketListener on
0.0.0.0:40754Oct 20, 2011 7:10:42 PM org.openqa.jetty.util.Container start
INFO: Started org.openqa.jetty.jetty.Server@c5dbb
19:10:43.236 INFO - Java: Oracle Corporation 21.0-b17
19:10:43.237 INFO - OS: Windows 7 6.1 x86
19:10:43.240 INFO - v2.8.0, with Core v2.8.0. Built from revision 14056
19:10:43.300 INFO - RemoteWebDriver instances should connect to:
http://127.0.0.1:5555/wd/hub19:10:43.301 INFO - Version Jetty/5.1.x
19:10:43.301 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
19:10:43.301 INFO - Started HttpContext[/selenium-server,/selenium-server]
19:10:43.301 INFO - Started HttpContext[/,/]
19:10:43.302 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1d94c80
19:10:43.302 INFO - Started HttpContext[/wd,/wd]
19:10:43.302 INFO - Started SocketListener on
0.0.0.0:555519:10:43.302 INFO - Started org.openqa.jetty.jetty.Server@17392df
19:10:43.304 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","capabilities":[{"platform":"WINDOWS","ensureCleanSession":true,"browserName":"internet explorer","version":""}],"configuration":{"port":5555,"register":true,"host":"10.252.48.10","cleanUpCycle":2000,"maxInstances":1,"proxy":"org.openqa.grid.selenium.proxy.WebDriverRemoteProxy","maxSession":1,"hubHost":"localhost","hubPort":40754,"timeout":120000,"url":"
http://xx.xxx.48.10:5555/wd/hub"}}
19:10:43.304 INFO - Registering the node to hub :
http://localhost:40754/grid/register19:10:43.404 WARN - Max instance not specified. Using default = 1 instance
Hub Ports Active :0
Exception in thread "main" org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connection to
http://xx.xxx.48.10:5555 refused
Build info: version: '2.8.0', revision: '14056', time: '2011-10-06 12:42:36'
System info:
os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:412)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:113)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:74)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:82)
at com.sarf.noderegistry.SpawnHubViaCode.testLocalGrid(SpawnHubViaCode.java:234)
at com.sarf.noderegistry.SpawnHubViaCode.main(SpawnHubViaCode.java:97)
Caused by: org.apache.http.conn.HttpHostConnectException: Connection to
http://xx.xxx.48.10:5555 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:380)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:359)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:395)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
... 13 more