JavaScript Asynchrony and async/await in Selenium WebDriver Tests

Asynchrony in JavaScript

JavaScript is an asynchronous language. All I/O in it will (almost) always be asynchronous. Meaning that a callback will be needed to notify the program when the I/O operation is done. But this is not true in most other languages. In Java, for example, doing I/O is a synchronous operation. A file copy looks like this:

Selenium WebDriver Code

Given all the above, imagine my surprise when I saw this Selenium WebDriver code:

The Future

It seems that the Selenium community understands that the scam that is this synchronous/asynchronous mode should be temporary:

What Now?

Want to learn more about browser tests? You can learn more in previous posts of mine — here and here.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store