I'm trying to launch Tor browser via puppeteer-sharp
. I am using .net core 3.1
console application and latest version of puppeteer-sharp
. So far the given the executable path console application launches the Tor Browser with an exception.
using PuppeteerSharp;
using System.Threading;
using System.Threading.Tasks;
namespace puppeteer_tor
{
internal class Program
{
static async Task Main(string[] args)
{
string enableAutomation = "--enable-automation";
string noSandBox = "--no-sandbox";
string disableSetUidSandBox = "--disable-setuid-sandbox";
string[] argumentsWithoutExtension = new string[] { "C:\\Users\\selaka.nanayakkara\\Desktop\\Tor Browser\\Browser\\TorBrowser\\Data\\profile.default", "--proxy-server=socks5://127.0.0.1:9050", "--disable-gpu", "--disable-dev-shm-usage", enableAutomation, disableSetUidSandBox, noSandBox };
var options = new LaunchOptions
{
Headless = false,
ExecutablePath = @"C:\Users\selaka.nanayakkara\Desktop\Tor Browser\Browser\firefox.exe",
Args = argumentsWithoutExtension
};
using (var browser = await Puppeteer.LaunchAsync(options))
{
Thread.Sleep(5000);
var page = await browser.NewPageAsync();
await page.GoToAsync("https://check.torproject.org/");
var element = await page.WaitForSelectorAsync("h1");
var text = element.ToString();
}
}
}
}
The browser launches with an issue and gives me the exception of :
Failed to launch browser!
With the below screen of the Tor browser :
Your help is much appreciated in the above issue. Thanks in advance.
Please find the attach code base here.