1. What is Selenium Remote WebDriver?
WIth Selenium Webdriver you could test a web application through a browser driver in the same system. But with the selenium remote driver, testing web application through the browser at the remote server was made possible what it means is that if a user at a Linux system upload a file in the web site to be tested, and you are writing scripts in Windows system you could still test it. It made cross-browser and cross-system possible and insulated the functionality of Grid in remote webdriver. Let's look at how selenium remote webdriver achieves this even.
2. Server and Client in Remote Webdriver
1. Server will always be present where the browser would be. Also running up the server could be done via CLI or code. Here will do with CLI below. Also, the server is referred to as a hub.
2. Setting up the client is the second step as the client would connect with the server running on a different system. The client here is the node, so make sure the hub is running first. Also, we would configure the hub to tell the requirements the server needs to fulfill in terms of the configuration of browser, and webdriver. Would also specify the IP address of the hub. Let us look at the difference between selenium webdriver vs selenium remote webdriver. Then would set up a node and a hub.
3. Selenium Webdriver VS Selenium Remote Webdriver
As discussed Selenium Webdriver was built to run the scripts for cross-browser testing of web application on the same system that is driver, browser, and code all are in the same machine with the same operating system. Whereas when we talk about selenium remote webdriver, it incorporates the concept of selenium grid in selenium webdriver by allowing the functionality of testing on browser situated at different system. It does so via the concept of hub and node where the code and node are on the same system and the browser is situated at a different system called a hub or the server. Let us look at them in a bit of detail below.
4.Setting up of hub and node in selenium remote webdriver
1. Download JRE at both the systems. You can download it from here
. Then install it in the system.
2. Set environment variables and add the path to bin folder like below
3. Download Selenium Remote Webdriver jar file from here
4. For the server use the command below and if you get the below output then hub is set perfectly.
java -jar selenium-server-standalone-3.141.59.jar
5. At the client side use the command where we set the port, chromedriver, browser name. Also we are installing them in the same system here, but for different systems use IP address instead of localhost. And if the node is set up properly you would get output like below.
java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome -port 1414
6.In the end, verify that both are set up properly by checking on the URL localhost:4444/grid/console
5. Code for Selenium Remote Webdriver in c#
Here options is used to define browser features where in BinaryLocation we specify the path of chrome and in Uri has the path for hub where browser and driver would be located as browser is always at sever end.
public class HomeController : Controller
public IActionResult Index()
ChromeOptions Options = new ChromeOptions();
Options.BinaryLocation = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
cap = new DesiredCapabilities();
driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), Options.ToCapabilities());
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
1. Selenium remote webdriver is used for cross-platform testing where browser it another system.
2. It works on hub acting as server and node with webdriver requirements at the client end.
3. Firstly we need to install java run time environment and then set its path in environment variable.
4. Then set up hub at the browser end and node at the client end.
5. Then run the script in visual studio using c# where URI has hub address and hub is server here where browser is present.