This post is going to be in-line with, what I have planned to speak in the flagship Selenium conference in Austin, Texas in April
Difference between NodeJs webdriver Bindings with other Language Bindings.
How do we solve Asynchronous ?
Now, firstly – What is promise ?
Simplest explanation: It is an easy way to avoid writing pyramid of doom
One main thing about the WebdriverJs is PROMISE MANAGER:
- WebDriverJS uses a promise “manager” to coordinate the scheduling and execution of all commands.
- The promise manager maintains a queue of scheduled tasks, executing each once the one before it in the queue is finished.
- Tasks are enqueued using the execute() function. Tasks always execute in a future turn of the event loop, once those before it in the queue (if there are any) have completed.
WebDriverJs with Promise Manager
Equivalent Java code
Deprecating Promise Manager
Removing it in favor of native language constructs.
To help with debugging, tests can be written with generators and WebDriver’s promise.consume function (or equivalent, from libraries like task.js).
2. Async Await
- The need to use promise.consume/task.js will be eliminated in TC39with the introduction of async functions
- An ES2016 language specification
- Grabbed from C#
- No callbacks, No promises, No control flow