Asynchronous Bindings

If you have code that executes an asynchronous task, you can define asynchronous bindings to execute the corresponding code using the async and await keywords.

An sample project using asynchronous bindings can be found here. The When binding in WebSteps.cs is asynchronous, and defined as follows:

[When(@"I want to get the web page '(.*)'")]
public async Task WhenIWantToGetTheWebPage(string url)
{
    await _webDriver.HttpClientGet(url);
}

The HTTPClientGet asynchronous task is defined in WebDriver.cs as follows:

public async Task HttpClientGet(string url)
{
    _httpResponseMessage = await _httpClient.GetAsync(url);
}