Monday, September 25, 2017

Automation Testing : A comparison of Synchronous and Asynchronous Web driver.

To start with the first one has to know the definition of synchronous and asynchronous.


  • Synchronous - That is it will run synchronously one after another.
  • Asynchronous - That is it will run independently of another.


So here the term comes when working with automation api of selenium webdriver. Selenium Webdriver is a tool that is used to automate user interaction on browsers to create a robotic environment where a task can be performed with minimal user assistance.

Selenium Webdriver supports few languages which include java, python, javascript etc.
Now when we deal with java webdriver behaves synchronously in dealing with user test steps but when we write the same code in javascript using webdriverjs the api behaves asynchronously thus steps do not wait for each other and starts getting executed together.

Selenium Webdriver in Java, python (Synchronous) -


  • Do not needs promises to work.
  • Dependent on the previous task to complete.
  • Can not run independent of previous task.
  • Slow process

Selenium WebdriverJS in Javascript (Asynchronous) -
  • Returns a promise after every webdriver call.
  • A promise can be anything value to an object that directs to the value.
  • Is denoted by then functions. 
  • It supports other framework which can work together like jasmine and make a complete phrase like  statement - then - expect.
  • Faster than Java, Python





Working on automation for java, python is one experience where as working on javascript is fully different. Here the main difference is of asynchronous behavior of js api which needs promises to support every test steps such that the test would be performed in an order.

P.S. Javascript or Java, Selenium is the best api to automate user interaction on a browser hands down.



No comments: