I\'m looking for the recommended/nicest way to make Selenium tests execute in several browsers one after another. The website I\'m testing isn\'t big, so I don\'t need a par
This is basically just an expansion of alanning's answer (Oct 21 '11 at 20:20). My case was similar, just that I did not want to run with the parameterless constructor (and thus use the default path to the driver executables). I had a separate folder containing the drivers I wanted to test against, and this seems to work out nicely:
[TestFixture(typeof(ChromeDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
public class BrowserTests where TWebDriver : IWebDriver, new()
{
private IWebDriver _webDriver;
[SetUp]
public void SetUp()
{
string driversPath = Environment.CurrentDirectory + @"\..\..\..\WebDrivers\";
_webDriver = Activator.CreateInstance(typeof (TWebDriver), new object[] { driversPath }) as IWebDriver;
}
[TearDown]
public void TearDown()
{
_webDriver.Dispose(); // Actively dispose it, doesn't seem to do so itself
}
[Test]
public void Tests()
{
//TestCode
}
}
}