0% found this document useful (0 votes)
21 views3 pages

Code and Commands

The document discusses setting up a Selenium Grid with a hub and node machines. It provides instructions on starting the hub, validating it is running, accessing the hub from a node, registering a node with the hub, and includes example code for running a test on the hub that launches a browser on the node.

Uploaded by

Afsal Sb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Code and Commands

The document discusses setting up a Selenium Grid with a hub and node machines. It provides instructions on starting the hub, validating it is running, accessing the hub from a node, registering a node with the hub, and includes example code for running a test on the hub that launches a browser on the node.

Uploaded by

Afsal Sb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Commands in Hub Machine

1.Setting Up Hub:
java -jar selenium-server-standalone-2.44.0.jar -role hub

2.Validating Hub started

http://localhost:4444/grid/console

Commands in Node Machine


3.Accessing Hub from Node Machine

http://iporhostnameofHub:4444/grid/console 

4.Registering Node with Hub

Java –jar selenium-server-standalone-2.44.0.jar –role webdriver –hub


http://iporhostnameofHub:4444/grid/register -port 5566

Code in Hub Machine

import java.io.File;

import java.net.MalformedURLException;

import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.junit.Test;

import org.openqa.selenium.Platform;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.firefox.FirefoxProfile;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.remote.RemoteWebDriver;

import org.testng.annotations.AfterMethod;

import org.testng.annotations.BeforeMethod;

public class Testparallel {

//protected ThreadLocal<RemoteWebDriver> threadDriver = null;

public static void main(String[] args) throws MalformedURLException {

WebDriver driver;

DesiredCapabilities capabilities = DesiredCapabilities.firefox();

capabilities.setCapability(FirefoxDriver.BINARY,new File("C:\\Program Files (x86)\\Mozilla


Firefox\\firefox.exe").getAbsolutePath());

driver = new RemoteWebDriver(new URL("http://192.168.0.106:5566/wd/hub"), capabilities);


driver.get("http://google.com");

System.out.println(driver.getTitle());

You might also like