From a3dff9d831f1c245496041b4a89c0320dbf0ff49 Mon Sep 17 00:00:00 2001 From: Mathias Lorenzen Date: Tue, 14 Mar 2017 15:13:37 +0100 Subject: [PATCH] added new VS2017 temp folder to gitignore and made it possible to clear the "lazy cache" of the driver used in the command provider. --- .gitignore | 1 + .../CommandProvider.cs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9db2c83..304bc12 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ _ReSharper*/ *~ pvc-packages *.nupkg +/.vs 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)