3

While making RemoteWebDriver object we need to pass URL and DesiredCapability Object. Browsing through different tutorial on net I found that in some they were passing URL of Node while in others they were passing URL of HUB. Please clarify which one is to be used Hub or Node Url. https://github.com/SeleniumHQ/selenium/wiki/Grid2

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

while in this tutorial & others they have used url of nodes http://www.guru99.com/introduction-to-selenium-grid.html

brij
  • 217
  • 7
  • 19
  • your webdriver initialization is absolutely correct.. for passing URL into remote webdriver just use driver.get("URL") – Saurabh Gaur May 11 '16 at 13:00
  • @SaurabhGaur my doubt is which URL is to be passed inside 'new RemoteWebDriver (new URL('Hub or Node ?') ' – brij May 11 '16 at 13:01
  • new URL("http://localhost:4444/wd/hub") – Saurabh Gaur May 11 '16 at 13:03
  • suppose my hub is running on xxx.xxx.xx.x:5555 and node is running on yyyy.yyyy.yy.y:6666, so there I need to pass new URL("xxxx.xxx.xx.x:5555/wd/hub"). Am I right ? – brij May 11 '16 at 13:07
  • No, because your node url derived from your hub. so your node url know the hub url.. so you provide new URL("xxxx.xxx.xx.x:6666/wd/hub") if you want to run test on node. – Saurabh Gaur May 11 '16 at 13:24
  • It is obvious that you will run all your test cases on node from hub.That is why you are using selenium Grid. So you will write your code on hub. And Under RemoteWebDriver code written on hub machine you mention the node capabilities. Hope this is clear :-) – Kishan Patel May 12 '16 at 03:26

1 Answers1

4

There are basically two usages for the RemoteWebDriver.

  1. You can use the RemoteWebDriver to directly talk to a Selenium Standalone. That is when you would pass it the IP of the node. [ You can see this yourself if you start a standalone using java -jar selenium-server-standalone.jar ] You will see a line as below.

RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub

  1. The second usage is when you are trying to talk to a Grid. In that case, you would always pass in the IP and Port of the Grid in your url viz., http://<IP>:<Port>/wd/hub
Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66