user9156301
user9156301

Reputation: 43

How to run a test on a specific IP using Selenium Grid

i have a few queries regarding Selenium Grid.

Consider the below scenario:

Machine A: registered as hub by command=

java -jar selenium-server-standalone-2.44.0.jar -role hub

Machine B:having Windows 7 and chrome browser

registered as node by command=java -Dwebdriver.chrome.driver="path of chrome driver" –jar selenium-server-standalone-2.44.0.jar –role webdriver –hub http://ipnameofHub:4444/grid/register -port 5566

Machine C: having Windows 7 and chrome browser​

registered as node​ by command=java -Dwebdriver.chrome.driver="path of chrome driver" –jar selenium-server-standalone-2.44.0.jar –role webdriver –hub http://ipnameofHub:4444/grid/register -port 5566

Machine D: having Windows 7 and chrome browser​

registered as node​ by command=java -Dwebdriver.chrome.driver="path of chrome driver" –jar selenium-server-standalone-2.44.0.jar –role webdriver –hub http://ipnameofHub:4444/grid/register -port 5566

DesiredCapabilities dc=new DesiredCapabilities();

dc.setBrowserName("chrome");

dc.setPlatform(Platform.WINDOWS);

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

When i run a test, which node will grid choose and on what basis, since all the nodes have the same platform and browser as specified in the DesiredCapabilities.

Is the node randomly chosen or the first node matching the DesiredCpabilities is chosen?

Question No.2

If i want to run a test on specifically Machine D, how can that be done.

Thanks in advance.

Upvotes: 1

Views: 1173

Answers (1)

Murthi
Murthi

Reputation: 5347

  1. it is chosen based on first matching capability and available node.

  2. To run on specific node, you can write your own algorithm to choose. the following link may help to write custom capability matcher https://www.assertthat.com/posts/make_your_selenium_grid_nodes_personalized

Upvotes: 1

Related Questions