3 ms·
The fact that they're async doesn't mean you're expected to be able to parallelize the calls, just that you can do something else while waiting for a response i
by Arnavion 5y ago
The fact that they're async doesn't mean you're expected to be able to parallelize the calls, just that you can do something else while waiting for a response if you want. They involve IPC to another process which can take its own arbitrary amount of time to return a response. There's no reason to block your program during that period.
I don't know anything about webdriver's API specifically, but as a general example, "do something else while waiting for a response" can include "stop waiting for a response after a timeout expires". Maybe you want to set a timeout on the "fetch a URL" function call. You can't do that with a synchronous function unless the function internally supports a timeout. With an asynchronous function you can just race it with a timeout future, and if the timeout future completes first you can stop waiting for the fetch future and fail your test.