We have a suite of UI tests being run using Specflow and Selenium WebDriver. Overnight these suddenly stopped working and now throw the following error on each Scenario:
BoDi.ObjectContainerException : Interface cannot be resolved: OpenQA.Selenium.IWebDriver (resolution path: Steps class)
We're using the Specflow Context Injection on register our webdriver before each scenario, which we then use in each of our steps classes:
[Binding]
public class Base
{
private readonly IObjectContainer _objectContainer;
private IWebDriver _webDriver;
public Base(IObjectContainer objectContainer)
{
_objectContainer = objectContainer;
}
[BeforeScenario]
public void Setup()
{
_webDriver = new ChromeDriver();
_objectContainer.RegisterInstanceAs<IWebDriver>(_webDriver);
}
....
}
Steps file:
[Binding]
public class ProductSteps : TechTalk.SpecFlow.Steps
{
private readonly IWebDriver _driver;
public ProductSteps(IWebDriver driver)
{
_driver = driver;
}
}
Looking online at the Specflow documentation I can see nothing wrong - and I can also find little to show anyone else ever having this problem!
I've spent a fair bit of time trying to get to the bottom of this but have had no luck whatsoever.
We're using NUnit as our test runner and have all the latest updates via nuget.