public override RemoteWebDriver Driver(bool useExistingBrowser = true) { // when useExistingBrowser is set open chrome if (useExistingBrowser) { ServiceBrowser.OpenBrowser(); } if (string.IsNullOrEmpty(BaseURL)) { throw new Exception($"{nameof(BaseURL)} is not set."); } // NOTE: This will cause problem when we run this code // in multi threaded program. Remove this code, to avoid // running into problems when experimenting with parallel runs. ServiceTask.CloseTask(nameof(ChromeDriver)); var options = new ChromeOptions { DebuggerAddress = $"{AppSettings.DebuggerBrowserUrl}:{ AppSettings.DebuggerBrowserPort}" }; options.AddArgument("no-sandbox"); //options.AddArguments(@"user-data-dir=C:\Users\amhus\AppData\Local\Google\Chrome\User Data\Default" /*Profile Path*/); //options.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"; ChromeDriver driver = null; RetryPolicy().Execute(() => { driver = new ChromeDriver(options); }); // Temp disabling this // SelectTab(driver); // If using existing window then you may not need to maximize it here. //driver.Manage().Window.Maximize(); // set default culture ServiceCulture.SetDefaultCulture(AppSettings.DefaultCulture); return(driver); }