ChromeDriverService chromeDriverService = ChromeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("--window-size=" + Size.X + "," + Size.Y, "--window-position=" + Position.X + "," + Position.Y);
chromeOptions.AddExcludedArgument("enable-automation");
chromeOptions.AddAdditionalCapability("useAutomationExtension", false);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.plugins", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.popups", 0);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.geolocation", 0);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.auto_select_certificate", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.mixed_script", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.media_stream", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.media_stream_mic", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.media_stream_camera", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.protocol_handlers", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.midi_sysex", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.push_messaging", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.ssl_cert_decisions", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.metro_switch_to_desktop", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.protected_media_identifier", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.site_engagement", 1);
chromeOptions.AddUserProfilePreference("profile.default_content_setting_values.durable_storage", 1);
chromeOptions.AddUserProfilePreference("useAutomationExtension", true);
chromeOptions.BinaryLocation = File.ReadAllText("pathBrave.txt");
chromeOptions.AddArgument("--mute-audio");
chromeOptions.AddArgument("--blink-settings=imagesEnabled=false");
if (!string.IsNullOrEmpty(ProfilePath.Trim()))
chromeOptions.AddArgument("--user-data-dir=" + ProfilePath);
chromeOptions.AddArgument("--blink-settings=imagesEnabled=false");
chromeOptions.AddArgument("--headless");
chromeOptions.AddArguments("--incognito");
if (!string.IsNullOrEmpty(Proxy.Trim()))
switch (Proxy.Split(':').Count())
chromeOptions.AddArgument("--proxy-server= 127.0.0.1:" + Proxy);
chromeOptions.AddArgument("--proxy-server= socks5://127.0.0.1:" + Proxy);
chromeOptions.AddArgument("--proxy-server= " + Proxy);
chromeOptions.AddArgument("--proxy-server= socks5://" + Proxy);
chromeOptions.AddArgument("--proxy-server= " + Proxy.Split(':')[0] + ":" + Proxy.Split(':')[1]);
chromeOptions.AddExtension("extension\\proxy.crx");
chromeOptions.AddArgument("--proxy-server= socks5://" + Proxy.Split(':')[0] + ":" + Proxy.Split(':')[1]);
chromeOptions.AddExtension("extension\\proxy.crx");
if (!HideBrowser && PathExtension.Trim() != "")
if (!Directory.Exists(PathExtension))
Directory.CreateDirectory(PathExtension);
string[] files = Directory.GetFiles(PathExtension);
for (int i = 0; i < files.Length; i++)
chromeOptions.AddExtension(files[i]);
if (!flag && !string.IsNullOrEmpty(App.Trim()))
chromeOptions.AddArgument("--app= " + App);
if (Proxy.Split(':').Count() == 4)
chromeOptions.AddArgument("--user-agent=" + UserAgent + "$PC$" + Proxy.Split(':')[2] + ":" + Proxy.Split(':')[3]);
chromeOptions.AddArgument("--user-agent=" + UserAgent);
chromeOptions.AddArgument("--autoplay-policy=no-user-gesture-required");
if (LinkToOtherBrowser != "" && File.Exists(LinkToOtherBrowser))
chromeOptions.AddArgument("disable-infobars");
chromeOptions.BinaryLocation = LinkToOtherBrowser;
chrome = new ChromeDriver(chromeDriverService, chromeOptions);
chrome.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(TimeWaitForSearchingElement);
chrome.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(TimeWaitForLoadingPage);
ExportError(null, ex, "chrome.Open()");
ChromeMin chrome = new ChromeMin
Size = new Point(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height),
ProfilePath = profilePath,
TimeWaitForSearchingElement = 3,
TimeWaitForLoadingPage = 60,