Hello, i am software architect and i started small project with Brave browser. Unfortunatelly i cannot run it with C# and Selenium in headless mode with tor.
I dont know why in normal mode it works good, but in headless mode it is not connecting to the tor network. Any suggestions?
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
while (true)
{
await RunMethod();
}
async Task RunMethod()
{
string chromedriverPath = @"D:\\Users\\sam_sepi0l\\Desktop\\BAT-Automatic\\BAT-Automatic\\BAT-Automatic\\chromedriver.exe";
var braveOptions = new ChromeOptions();
braveOptions.BinaryLocation = @"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe";
braveOptions.AddArgument("--tor");
braveOptions.AddArgument("--headless");
IWebDriver driver = new ChromeDriver(chromedriverPath, braveOptions);
Thread.Sleep(25000);
driver.Navigate().GoToUrl("https://mojeip.cz");
Thread.Sleep(30000);
IWebElement element = driver.FindElement(By.XPath("/html/body/section/div/div/div[1]/p[1]/font[1]"));
Console.WriteLine(element.Text);
}