protected async Task <IActivityExecutionResult> ExecuteDriver(ActivityExecutionContext context, Func <IWebDriver, Task> action) { var driverId = GetDriverId(context) !; try { var driver = _factory.GetDriver(driverId); await action(driver); if (Result != default) { return(Result); } return(Done()); } catch (Exception e) { if (driverId != default !) { await _factory.CloseBrowserAsync(driverId); } return(Fault(e)); } }
public void SetUp() { var config = ContainerConfig.Configure(); using (var scope = config.BeginLifetimeScope()) { _testSettings = scope.Resolve <ApplicationConfiguration>().GetApplicationConfiguration <TestSettings>(); _log = scope.Resolve <ILog>(); _browser = scope.Resolve <IBrowserFactory>(new TypedParameter(typeof(ILog), _log)); _browser.Start(_testSettings.Browser); _pages = scope.Resolve <IUoW>(new NamedParameter("_driver", _browser.GetDriver()), new NamedParameter("_testSettings", _testSettings), new NamedParameter("_log", _log)); } }