The easiest step-by-step automation guide :-Downloading and setting up the Selenium grid framework for Windows :-Weblog Diary :)


Overview of Selenium Grid:-

The Selenium grid allows you to test between browsers by triggering test cases on different machines for different browsers. Distributed test execution. You need to configure the hub and node so that all nodes listen to the hub to run the test. Control of test triggers is on the local machine and is done by calling the browser on the remote computer / machine.

Hub:- A hub is a local machine that creates and triggers all test cases.
node:- The browser is called on a remote machine called a node.

Benefits of using a grid:-

We know that selenium allows web automation for multiple browsers, but we also know that only one Internet Explorer, Chrome, or Firefox browser can be downloaded to your local machine. If you want to run hundreds of test cases in different browsers, the selenium grid can help. If you have hundreds of test cases in real time, it will take forever to trigger them one by one. Selenium Grid saves time and runs multiple tests in parallel on multiple browsers on different nodes configured on a single hub (local machine).

Step-by-step guide to running tests using Selenium grid:-

Step 1:-Download the Selenium standalone server and Java development kit .Jar files to both the hub and the node machine.

(I) Download the standalone server jar file from (https://ift.tt/31HTh4V) to both the hub machine and the node machine.

(II) Download the Java Development Kit (JDK) on both the hub machine and the node machine, and set the path in the environment variables.

(A) Java (JDK) at https://ift.tt/3cLtuwb

Step 2:-Set the JDK path in the system variables on both the hub machine and the node machine.

(I) To set environment variables, go to the advanced system settings on your local machine (hub) and nod machine.

(II) Click New to start adding the JAVA_HOME path

(III) Go to the program file, click Java, open the saved (jdk1.8.0_241) folder, and copy the address.

(IV) Paste it into an environment variable named JAVA_HOME.

(V) Click the path in the system variable and add the Java bin path.

(VI) To get the Java bin path again, go to the JDK folder where you saved it and click the bin folder.

(VII) Copy the address to the bin folder

(VIII) Select the path and click the new button to paste it into the new path of the system variable.

Step 3:-Download the Chrome and Gecko drivers for Chrome and Firefox browsers respectively. (Download the chrome driver and gecko driver .exe files to the node machine where the Selenium server jar is stored.)

(I) Chrome driver (chromedriver_win32.zip) from: -https: //chromedriver.storage.googleapis.com/index.html? path = 81.0.4044.69 /

(II) Gecko driver for Firefox browser (geckodriver-v0.26.0-win64.zip):-https: //github.com/mozilla/geckodriver/releases

Step 4:-Open a command prompt and call the Jar file.

(I) Paste this into the command prompt and press Enter:-
java -jar selenium-server-standalone-3.141.59.jar-role hub

Step 5:-Open a browser and paste the grid IP address:-

10.0.0.159: 4444 / grid / console or Localhost: 4444 / grid / console

Step 6:-Log in to another machine and register as a node machine.

(I) Open a command prompt and call the Jar file (same method as above)
(II) To call the Chrome browser on the node machine, paste the following command into the node command and press the Enter key.
java -Dwebdriver.chrome.driver = ”C: chromedriver.exe” -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub https://ift.tt/2UFCIlS -port 5566

The hub machine updates the information by saying that it has registered the node.

Step 7:-After registering the node on another machine, update the browser on the hub machine where you entered the grid IP address.

You can send 11 requests to this node. This node can run 5 Firefox, 1 Internet Explorer and 5 Chrome instances at a time.

Step 8:-Import the Selenium standalone server jar into your Eclipse project.

To import the Selenium standalone server Jar, click on the Java project, go to Properties, select the Java build path and click Add External Jar.

Now you are ready to create test cases on your hub machine (Eclipse IDE) with the features you need.

code:-

Import java.net.MalformedURLException;
Import java.net.URL.
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
Public class remotetest {
public static void main (String[] args) throws MalformedURLException {
// TODO auto-generated method stub
// Automation-chrome, firefox, ie, safari

DesiredCapabilities dc = new DesiredCapabilities ();
dc.setBrowserName (“chrome”);
dc.setPlatform (Platform.WINDOWS);

// Webdriver driver = new ChromeDriver ();
WebDriver driver = new RemoteWebDriver (new URL (“http: // localhost: 4444 / wd / hub & # 8221;), dc);
driver.get (“http: //google.com”);

}
}

The post The easiest step-by-step automation guide :-Downloading and setting up the Selenium grid framework for Windows :-Weblog Diary :) appeared first on WHYcredi.

NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post