diff --git a/src/TestStack.Seleno/Configuration/SelenoApplication.cs b/src/TestStack.Seleno/Configuration/SelenoApplication.cs index 97bdd959..b52832c3 100644 --- a/src/TestStack.Seleno/Configuration/SelenoApplication.cs +++ b/src/TestStack.Seleno/Configuration/SelenoApplication.cs @@ -19,8 +19,13 @@ internal class SelenoApplication : ISelenoApplication private bool _disposed; private readonly IContainer _container; + private IWebDriver _browser; + + public IWebDriver Browser + { + get { return _browser ?? (_browser = _container.Resolve()); } + } - public IWebDriver Browser { get; } public ICamera Camera { get; } public IDomCapture DomCapture { get; } public ILogger Logger { get; } @@ -33,7 +38,6 @@ internal class SelenoApplication : ISelenoApplication public SelenoApplication(IContainer container) { _container = container; - Browser = _container.Resolve(); Camera = _container.Resolve(); DomCapture = _container.Resolve(); Logger = _container.Resolve().Create(GetType()); diff --git a/src/TestStack.Seleno/Configuration/SelenoHost.cs b/src/TestStack.Seleno/Configuration/SelenoHost.cs index 7518ae61..fdd20943 100644 --- a/src/TestStack.Seleno/Configuration/SelenoHost.cs +++ b/src/TestStack.Seleno/Configuration/SelenoHost.cs @@ -74,13 +74,7 @@ public void Run(WebApplication app, Action configure) /// Any configuration changes you would like to make public void Run(Action configure) { - Action action = x => - { - if (configure != null) - configure(x); - }; - - Application = CreateApplication(action); + Application = CreateApplication(x => configure?.Invoke(x)); AppDomain.CurrentDomain.DomainUnload += CurrentDomainDomainUnload; }