diff --git a/.gitignore b/.gitignore index f14d16c..0e50caa 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ obj/ Ankh.NoLoad *.svclog packages/ +.vs/ #Tooling _ReSharper*/ diff --git a/FluentAutomation.SeleniumWebDriver/CommandProvider.cs b/FluentAutomation.SeleniumWebDriver/CommandProvider.cs index c60c6f6..394cbae 100644 --- a/FluentAutomation.SeleniumWebDriver/CommandProvider.cs +++ b/FluentAutomation.SeleniumWebDriver/CommandProvider.cs @@ -18,7 +18,9 @@ namespace FluentAutomation public class CommandProvider : BaseCommandProvider, ICommandProvider, IDisposable { private readonly IFileStoreProvider fileStoreProvider = null; - private readonly Lazy lazyWebDriver = null; + private readonly Func webDriverFactory = null; + + private Lazy lazyWebDriver = null; private IWebDriver webDriver { get @@ -33,6 +35,14 @@ public CommandProvider(Func webDriverFactory, IFileStoreProvider fil { FluentTest.ProviderInstance = null; + this.webDriverFactory = webDriverFactory; + this.fileStoreProvider = fileStoreProvider; + + ReconfigureWebDriver(); + } + + protected void ReconfigureWebDriver() + { this.lazyWebDriver = new Lazy(() => { var webDriver = webDriverFactory(); @@ -41,7 +51,7 @@ public CommandProvider(Func webDriverFactory, IFileStoreProvider fil webDriver.Manage().Cookies.DeleteAllCookies(); webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10)); - + // If an alert is open, the world ends if we touch the size property. Ignore this and let it get set by the next command chain try { @@ -74,8 +84,6 @@ public CommandProvider(Func webDriverFactory, IFileStoreProvider fil return webDriver; }); - - this.fileStoreProvider = fileStoreProvider; } public ICommandProvider WithConfig(FluentSettings settings) @@ -628,6 +636,7 @@ public void SwitchToFrame(ElementProxy frameElement) } public static IAlert ActiveAlert = null; + private void SetActiveAlert() { if (ActiveAlert == null)