Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ obj/
Ankh.NoLoad
*.svclog
packages/
.vs/

#Tooling
_ReSharper*/
Expand Down
17 changes: 13 additions & 4 deletions FluentAutomation.SeleniumWebDriver/CommandProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ namespace FluentAutomation
public class CommandProvider : BaseCommandProvider, ICommandProvider, IDisposable
{
private readonly IFileStoreProvider fileStoreProvider = null;
private readonly Lazy<IWebDriver> lazyWebDriver = null;
private readonly Func<IWebDriver> webDriverFactory = null;

private Lazy<IWebDriver> lazyWebDriver = null;
private IWebDriver webDriver
{
get
Expand All @@ -33,6 +35,14 @@ public CommandProvider(Func<IWebDriver> webDriverFactory, IFileStoreProvider fil
{
FluentTest.ProviderInstance = null;

this.webDriverFactory = webDriverFactory;
this.fileStoreProvider = fileStoreProvider;

ReconfigureWebDriver();
}

protected void ReconfigureWebDriver()
{
this.lazyWebDriver = new Lazy<IWebDriver>(() =>
{
var webDriver = webDriverFactory();
Expand All @@ -41,7 +51,7 @@ public CommandProvider(Func<IWebDriver> 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
{
Expand Down Expand Up @@ -74,8 +84,6 @@ public CommandProvider(Func<IWebDriver> webDriverFactory, IFileStoreProvider fil

return webDriver;
});

this.fileStoreProvider = fileStoreProvider;
}

public ICommandProvider WithConfig(FluentSettings settings)
Expand Down Expand Up @@ -628,6 +636,7 @@ public void SwitchToFrame(ElementProxy frameElement)
}

public static IAlert ActiveAlert = null;

private void SetActiveAlert()
{
if (ActiveAlert == null)
Expand Down