Wrap specflow scenario within try-catch Wrap specflow scenario within try-catch selenium selenium

Wrap specflow scenario within try-catch


I found a workaround for this issue where I can check for the exception after each step using the [AfterStep] binding. This works for me, and tests that failed are now marked as inconclusive:

[AfterStep]    public void check()    {        var exception = ScenarioContext.Current.TestError;        if (exception is WebDriverException             && exception.Message.Contains("The HTTP request to the remote WebDriver server for URL "))        {            Assert.Inconclusive(exception.Message);        }    }

Hopefully someone finds this helpful!