Вылетает ошибка (os error 10061)
Не могу понять в чем проблема. Либо вылетает исключение
OpenQA.Selenium.WebDriverException: 'The HTTP request to the remote WebDriver server for URL http://localhost:62281/session timed out after 60 second , либо (os error 10061).
Брандмауэр выключал, правило для порта 10061 создавал - ничего не помогает
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
BrowserAutomator browserAutomator = new BrowserAutomator();
browserAutomator.Automate();
Console.Write(1);
Console.Read();
}
}
public class BrowserAutomator
{
public void Automate()
{
String torPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Tor Browser\\Browser\\firefox.exe");
String profilePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "\\TorBrowser\\Data\\Browser\\profile.default\\");
String geckodriverPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "geckodriver-v0.29.1-win64");
FirefoxProfile profile = new FirefoxProfile(profilePath);
profile.SetPreference("network.proxy.type", 1);
profile.SetPreference("network.proxy.socks", "127.0.0.1");
profile.SetPreference("network.proxy.socks_port", 9153);
profile.SetPreference("network.proxy.socks_remote_dns", false);
FirefoxDriverService firefoxDriverService = FirefoxDriverService.CreateDefaultService(geckodriverPath);
firefoxDriverService.FirefoxBinaryPath = torPath;
firefoxDriverService.BrowserCommunicationPort = 2828;
var firefoxOptions = new FirefoxOptions
{
Profile = null,
LogLevel = FirefoxDriverLogLevel.Trace
};
firefoxOptions.AddArguments("-profile", profilePath);
firefoxOptions.AddArguments("no-sandbox");
FirefoxDriver driver = new FirefoxDriver(firefoxDriverService, firefoxOptions);
driver.Navigate().GoToUrl("https://www.google.com");
}
}
}