Project

General

Profile

Bug #40693

Updated by Patrick Seidensal over 4 years ago

Since Node.js 7.6, async and await keywords are supported as syntactic sugar for Promises. Using async/await for Promises has a number of benefits:

- The extensive indentation through the extensive use of callbacks/Promises would be removed. That makes the code more concise and easier to read.
- Error handling is unified again. `try/catch` blocks can be used to catch errors for both, asynchronous and synchronous code.
- The Code will be easier to write. For instance, a `for loop` could be used instead of having to use recursive calls.
- The workflow looks more like non-asyncronous code, hence easier to read and write.
- The code will be future-proof already as async/await is in the ECMA script specification.
- The code will be easier to debug.

Selenium also already works on deprecating the "WebDriverJS promise manager":https://github.com/SeleniumHQ/selenium/issues/2969 in favor of async/await.

Back