Friday 25 March 2016

Selenium Webdriver JSON Protocol

Did you ever wonder how Selenium 2.0 works internally?
In this post, you will get to know how selenium automates the browser.

Selenium API sends HTTP commands in the form of JSON protocol to Selenium Server.
Selenium server then uses native browser API to automate the browser.

So when use below statement in your code -
driver = new ChromeDriver();

It actually sends the below HTTP command to the selenium server.

POST /session

For each selenium API method, there is a corresponding HTTP request that is sent to the server. Here is the list of some of the HTTP commands that are sent to Selenium Server.

  1. POST /session  - Create new session
  2. GET /status - Get the state of server
  3. DELETE /session/:sessionId - Delete the session with id - sessionId
  4. POST /session/:sessionId/timeouts/implicit_wait  - Specify the amount of time the driver should wait when searching for elements.
  5. GET /session/:sessionId/url - Navigate to the specific url
Below image demonstrates how the JSON protocol works in Selenium.



More information at below links -
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com

1 comment:

Buy Best Selenium Books

Contributors