I need to open the chrome browser with Tor proxy settings using selenium. I have achieved success with firefox but it is not very agile, so it is necessary to use chrome. The problem is that I do not know how to apply the settings to chrome.
I need a functional solution for the cromedriver.
In firefox I did so, this method is called after TOR BROWSER is opened:
private void ConfigureBrowser()
{
Logger.Log($"{Logger.MethodName()} -- Configurando Firefox...");
try
{
var ffOptions = new FirefoxOptions();
ffOptions.SetPreference("network.proxy.type", 1);
ffOptions.SetPreference("network.proxy.socks", "127.0.0.1");
ffOptions.SetPreference("network.proxy.socks_port", 9150);
ffOptions.AcceptInsecureCertificates = true;
var t = @"WebDrivers\";
Logger.Log($"{Logger.MethodName()} PATH GECKO -> {t}", ConsoleColor.DarkMagenta);
this.DRIVER = new FirefoxDriver(t, ffOptions);
this.Wait = new WebDriverWait(this.DRIVER, TimeSpan.FromSeconds(80));
Logger.Log($"{Logger.MethodName()} FIREFOX OK", ConsoleColor.DarkGreen);
}
catch (System.Exception e)
{
Logger.Log($"{Logger.MethodName()} ERRO AO INICIAR FIREFOX -> {e.ToString()}", ConsoleColor.DarkRed);
throw;
}
}