Selenium WebDriver By Arti Tripathi & Amit Agarwal
Agenda What is Selenium Grid? What is Selenium Hub and Node? Setting up Selenium Grid 2 using multiple VMs. Configuring Grid 2 using webconfig.txt JSON format configuration file. Running Grid 2 console in browser. Update setup method of BaseTestSetup.java file. Update TestNG.xml file. Run test scripts on multiple VMs using Grid 2.
What is Selenium Grid? Selenium-Grid allows you run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, Selenium-Grid support distributed test execution. It allows for running your tests in a distributed test execution environment.
What is Selenium Hub and Node? Hub – Implies selenium grid 2 hub which distributes tests among multiple nodes registered to it at runtime. Node – One node represents one machine where test will be running & we can have multiple nodes those will be registered with one centralized hub which will be running on anyone machine.
Setting up Selenium Grid 2 using multiple VMs. Download latest version of selenium-server-standalone- x.x.x.jar . Create JSON configuration file. Copying both ‘selenium-server-standalone- x.x.x.jar ’ and ‘webconfig.txt’ on number of machines/VMs required for testing. Run Hub and Nodes.
Configuring Grid 2 using webconfig.txt JSON format configuration file. browsersName & maxInstances port host hubPort hubHost
Running Grid 2 console in browser. Open the browser, Enter the following URL:- http://put_hub_machine_name:4444/grid/console (Note: - Don’t forget to enter the “ hub_machine_name ” in above URL)