Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
417 views
by The go-to Tester (232 points)
What is Client - Server mechanism in Selenium?

Please help to clarify it!

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer
Executing JQuery and Javascripts on the browser are the best ways to imitate the user actions. If you have a look at the core architecture of Selenium WebDriver, it is completely developed on top of Javascript and JQuery.

This is what happens when you execute code on the Selenium Server.

Step 1: JSON request is formed and sent to the grid hub in case of grid machine or local server in case of you are running a local browser using FirefoxBrowser, ChromeBrowser and such non remote browser class.

Step 2: The server parses your query and form JQuery.

Step 3: Server executes your query in the browser and return the response in JSON format.

Step 4: JSON response is parsed by the client and returned to you.

 

Your client side code can be created using any language, such as Java, Python, C#. All these client side code will just convert your commands into JSON request. One by one these requests are sent to the server.

Here server can be of three types

  1. Standalone server
  2. Grid
  3. Local server

1. Standalone server: This is the server which we initiate by using the command java -jar selenium-standalone-<version>.jar. With standalone server, we can execute only one browser at a time. We will have to use RemoteWebDriver class to work with the server

2. Grid: We can initiate the grid hub by using the command java -jar selenium-standalone-<version>.jar -role hub. With the Grid, we can start any number of browsers in parallel at a time. We will have to use RemoteWebDriver class to work with the Grid.

3. Local server:  The Local server are the once which are initiated locally and on the fly. We do not need the external server like Grid or Standalone server to execute your tests. We can a start local server by using respective browser driver class. Eg. FirefoxDriver, ChromeDriver, InternetExplorerDriver, etc 

 

Once your browser is open, client side code will send the formed JSON command to appropriate browser server. The server will parse those JSON file and convert that to Javascript or JQuery. The server then executes the Javascript or JQuery code on the browser. The result of the execution is formed as JSON response and returned back to the client.

Your client will parse the response and provide you with readable format.

 Anything beyond the scope of Javascript and JQuery can not be handled by the Selenium WebDriver.

 

Hope my answer helped. Kindly feel free to write back if you need more details.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...