How It Works
WebDriver commands are asynchronus. They are scheduled on a control flow and return promises, not primitive values (see The WebDriver Control Flow).
Your test scripts send commands to the Selenium Server, which in turn communicates with the browser driver. Read on for more details.