public void SetupInfrastructure()
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .AddEnvironmentVariables()
                                    .Build();

            var configFactory = new ConfigurationFactory(config);

            ObjectContainer.RegisterInstanceAs(configFactory.Create <MovieLoggerConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <ImageLoggingConfig>());

            ImageLogging = new ImageLogging(ObjectContainer.Resolve <ImageLoggingConfig>());
            MovieLogger  = new MovieLogger(ObjectContainer.Resolve <MovieLoggerConfig>(), Metadata);

            ObjectContainer.RegisterInstanceAs(ImageLogging);
            ObjectContainer.RegisterInstanceAs(MovieLogger);

            Register <ElementFactory>(new SpecializedElementFactory());
            Register <XpathProvider>(new XpathProvider());
            Register <SelectorFactory>(new SpecializedSelectorFactory(ElementFactory, XpathProvider).UseBootstrap());

            Register(new PossumLabs.Specflow.Selenium.WebDriverManager(
                         this.Interpeter,
                         this.ObjectFactory,
                         new PossumLabs.Specflow.Selenium.Configuration.SeleniumGridConfiguration()));

            Log.Message($"feature: {FeatureContext.FeatureInfo.Title} scenario: {ScenarioContext.ScenarioInfo.Title} \n" +
                        $"Tags: {FeatureContext.FeatureInfo.Tags.LogFormat()} {ScenarioContext.ScenarioInfo.Tags.LogFormat()}");

            WebDriverManager.Initialize(BuildDriver);
        }
        protected virtual void SetupInfrastructure()
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .AddEnvironmentVariables()
                                    .Build();

            ObjectContainer.RegisterInstanceAs(config);
            ObjectContainer.RegisterInstanceAs(new DatetimeManager(() => DateTime.Now));
            ObjectContainer.RegisterInstanceAs(new DirectoryInfo(Environment.CurrentDirectory));
            ObjectContainer.RegisterInstanceAs(new ScenarioMetadata(() => ScenarioContext.TestError != null));

            IoCInitialialization();

            var configFactory = ObjectContainer.Resolve <IConfigurationFactory>();

            ObjectContainer.RegisterInstanceAs(configFactory.Create <MovieLoggerConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <ImageLoggingConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <SeleniumGridConfiguration>());

            ObjectContainer.Resolve <ISelectorFactory>().UseBootstrap();
            ObjectContainer.Resolve <IFileManager>()
            .Initialize(FeatureContext.FeatureInfo.Title,
                        ScenarioContext.ScenarioInfo.Title,
                        null /*Specflow limitation*/);

            Log.Message($"Feature: {FeatureContext.FeatureInfo.Title} Scenario: {ScenarioContext.ScenarioInfo.Title} \n" +
                        $"Tags: {FeatureContext.FeatureInfo.Tags.LogFormat()} {ScenarioContext.ScenarioInfo.Tags.LogFormat()}");

            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

            WebDriverManager.Initialize(BuildDriver);
            WebDriverManager.WebDriverFactory = WebdriverFactory;
        }
        public void SetupInfrastructure()
        {
            var metadata = new ScenarioMetadata
            {
                FeatureName  = FeatureContext.FeatureInfo.Title,
                ScenarioName = ScenarioContext.ScenarioInfo.Title
            };

            Register(metadata);

            var factory = new PossumLabs.Specflow.Core.Variables.ObjectFactory();

            Register(factory);
            Register(new PossumLabs.Specflow.Core.Variables.Interpeter(factory));
            var logger = new DefaultLogger(new DirectoryInfo(Environment.CurrentDirectory));

            Register((PossumLabs.Specflow.Core.Logging.ILog)logger);

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .Build();

            var configFactory = new ConfigurationFactory(config);

            ObjectContainer.RegisterInstanceAs(configFactory.Create <MovieLoggerConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <ImageLoggingConfig>());

            Register <ElementFactory>(new ElementFactory());
            Register <XpathProvider>(new XpathProvider());
            Register <SelectorFactory>(new SelectorFactory(ElementFactory, XpathProvider).UseBootstrap());

            Register(new PossumLabs.Specflow.Selenium.WebDriverManager(
                         this.Interpeter,
                         this.ObjectFactory,
                         new PossumLabs.Specflow.Selenium.Configuration.SeleniumGridConfiguration()));

            Log.Message($"feature: {FeatureContext.FeatureInfo.Title} scenario: {ScenarioContext.ScenarioInfo.Title} \n" +
                        $"Tags: {FeatureContext.FeatureInfo.Tags.LogFormat()} {ScenarioContext.ScenarioInfo.Tags.LogFormat()}");

            WebDriverManager.Initialize(BuildDriver);
        }
        protected virtual void SetupInfrastructure()
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .AddEnvironmentVariables()
                                    .Build();

            NetworkWatcher = new NetworkWatcher();

            var configFactory = new ConfigurationFactory(config);

            ObjectContainer.RegisterInstanceAs(configFactory.Create <MovieLoggerConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <ImageLoggingConfig>());
            WebElementSourceLog = new WebElementSourceLog();

            ImageLogging = new ImageLogging(ObjectContainer.Resolve <ImageLoggingConfig>());
            Register(new FileManager(new DatetimeManager(() => DateTime.Now)));
            FileManager.Initialize(FeatureContext.FeatureInfo.Title, ScenarioContext.ScenarioInfo.Title, null /*Specflow limitation*/);
            MovieLogger = new MovieLogger(FileManager, ObjectContainer.Resolve <MovieLoggerConfig>(), Metadata);

            ObjectContainer.RegisterInstanceAs(ImageLogging);
            ObjectContainer.RegisterInstanceAs(MovieLogger);

            Logger = new DefaultLogger(new DirectoryInfo(Environment.CurrentDirectory), new YamlLogFormatter());
            Register((PossumLabs.Specflow.Core.Logging.ILog)Logger);
            Register <ElementFactory>(new ElementFactory());
            Register <XpathProvider>(new XpathProvider());
            Register <SelectorFactory>(new SelectorFactory(ElementFactory, XpathProvider).UseBootstrap());
            Register(new PossumLabs.Specflow.Selenium.WebDriverManager(
                         this.Interpeter,
                         this.ObjectFactory,
                         new SeleniumGridConfiguration()));

            var dataGeneratorRepository = new DataGeneratorRepository(Interpeter, ObjectFactory);

            Register <DataGenerator>(dataGeneratorRepository.BuildGenerator());


            var templateManager = new PossumLabs.Specflow.Core.Variables.TemplateManager();

            templateManager.Initialize(Assembly.GetExecutingAssembly());
            Register(templateManager);

            Log.Message($"feature: {FeatureContext.FeatureInfo.Title} scenario: {ScenarioContext.ScenarioInfo.Title} \n" +
                        $"Tags: {FeatureContext.FeatureInfo.Tags.LogFormat()} {ScenarioContext.ScenarioInfo.Tags.LogFormat()}");

            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

            WebDriverManager.Initialize(BuildDriver);
            WebDriverManager.WebDriverFactory = () =>
            {
                var options = new ChromeOptions();

                //grid
                options.AddAdditionalCapability("username", WebDriverManager.SeleniumGridConfiguration.Username, true);
                options.AddAdditionalCapability("accessKey", WebDriverManager.SeleniumGridConfiguration.AccessKey, true);

                var driver = new RemoteWebDriver(new Uri(WebDriverManager.SeleniumGridConfiguration.Url), options.ToCapabilities(), TimeSpan.FromSeconds(180));
                //do not change this, the site is a bloody nightmare with overlaying buttons etc.
                driver.Manage().Window.Size = WebDriverManager.DefaultSize;
                var allowsDetection = driver as IAllowsFileDetection;
                if (allowsDetection != null)
                {
                    allowsDetection.FileDetector = new LocalFileDetector();
                }
                return(driver);
            };
        }
        public void SetupInfrastructure()
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                    .AddEnvironmentVariables()
                                    .Build();

            var configFactory = new ConfigurationFactory(config);

            ObjectContainer.RegisterInstanceAs(configFactory.Create <MovieLoggerConfig>());
            ObjectContainer.RegisterInstanceAs(configFactory.Create <ImageLoggingConfig>());

            Register(new FileManager(new DatetimeManager(() => DateTime.Now)));
            ImageLogging = new ImageLogging(ObjectContainer.Resolve <ImageLoggingConfig>());
            MovieLogger  = new MovieLogger(FileManager, ObjectContainer.Resolve <MovieLoggerConfig>(), Metadata);

            ObjectContainer.RegisterInstanceAs(ImageLogging);
            ObjectContainer.RegisterInstanceAs(MovieLogger);

            var logger = new DefaultLogger(new DirectoryInfo(Environment.CurrentDirectory));

            Register((PossumLabs.Specflow.Core.Logging.ILog)logger);
            Register <ElementFactory>(new ElementFactory());
            Register <XpathProvider>(new XpathProvider());
            Register <SelectorFactory>(new SelectorFactory(ElementFactory, XpathProvider).UseBootstrap());
            Register(new PossumLabs.Specflow.Selenium.WebDriverManager(
                         this.Interpeter,
                         this.ObjectFactory,
                         new SeleniumGridConfiguration()));


            FileManager.Initialize(FeatureContext.FeatureInfo.Title, ScenarioContext.ScenarioInfo.Title, null /*Specflow limitation*/);

            var templateManager = new PossumLabs.Specflow.Core.Variables.TemplateManager();

            templateManager.Initialize(Assembly.GetExecutingAssembly());
            Register(templateManager);

            Log.Message($"feature: {FeatureContext.FeatureInfo.Title} scenario: {ScenarioContext.ScenarioInfo.Title} \n" +
                        $"Tags: {FeatureContext.FeatureInfo.Tags.LogFormat()} {ScenarioContext.ScenarioInfo.Tags.LogFormat()}");

            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

            WebDriverManager.Initialize(BuildDriver);
            WebDriverManager.WebDriverFactory = () =>
            {
                var options = new ChromeOptions();
                // https://stackoverflow.com/questions/22322596/selenium-error-the-http-request-to-the-remote-webdriver-timed-out-after-60-sec?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
                options.AddArgument("no-sandbox"); //might be a fix :/
                options.AddArgument("disable-popup-blocking");
                options.AddArgument("disable-gpu");
                options.AddArgument("disable-extensions");
                options.AddArgument("disable-dev-shm-usage");

                options.AddAdditionalCapability("username", WebDriverManager.SeleniumGridConfiguration.Username, true);
                options.AddAdditionalCapability("accessKey", WebDriverManager.SeleniumGridConfiguration.AccessKey, true);

                //TODO: Config value
                var driver = new RemoteWebDriver(new Uri(WebDriverManager.SeleniumGridConfiguration.Url), options.ToCapabilities(), TimeSpan.FromSeconds(180));
                //do not change this, the site is a bloody nightmare with overlaying buttons etc.
                driver.Manage().Window.Size = WebDriverManager.DefaultSize;
                var allowsDetection = driver as IAllowsFileDetection;
                if (allowsDetection != null)
                {
                    allowsDetection.FileDetector = new LocalFileDetector();
                }
                return(driver);
            };
        }