I am new to the selenium and I have been trying to start Selenium Hub and adding the node to the Hub using java. I have started it using command prompt but I want it to happen on its own. I am able to start the Hub but have no Idea how to add the Node.
Following is my code to start the Hub:
import org.openqa.grid.internal.utils.configuration.GridHubConfiguration;
import org.openqa.grid.internal.utils.configuration.GridNodeConfiguration;
import org.openqa.grid.web.Hub;
public class StartHub {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
GridHubConfiguration configHub = new GridHubConfiguration();
configHub.host = "localhost";
configHub.port = 8060;
//GridNodeConfiguration configNode = new GridNodeConfiguration();
//configNode.host = configHub.host;
//configNode.port = 5300;
Hub hub = new Hub(configHub);
//configNode.getHubHost();
hub.start();
//System.out.println(configNode.getRemoteHost());
//hub.stop();
}
}
How to add a Node going forward ?
Selenium-Grid Server Version 2.x.x configuration.
HUB
Grid HUB Running as a standalone server
: Hub is a central point which distributing tests on several node-machines, which are registered to it for parallel execution.Use GRID HUB Server:
NODE [RC] has to post a request to HUB in order to register with it, by this URL -
IP:Port//grid/register
.Selenium-Grid - JSON Configuration Files for HUB & NODE are
gridHub.json
,registerNode.json
to instantiate.Selenium-Grid Server Version 3.x.x (>= beta4) configuration.
Use different JSON format to overcome the Exception -
org.openqa.grid.common.exception.GridConfigurationException: Error with the JSON of the config : Deprecated -nodeConfig file encountered.
registerNode2.json