I’m working on a C# project where I need a headless browser that can execute JavaScript and route traffic through a proxy server. Right now I’m trying to figure out the best approach for this setup.
My requirements are pretty simple - I just need the browser to load pages and run whatever JavaScript is already on those pages. I’m not looking to inject custom scripts or do complex DOM manipulation.
The main challenge I’m facing is getting proxy support working properly. I’ve looked at a few different options but haven’t found a clean solution yet.
Has anyone dealt with this kind of setup before? What headless browser libraries work well for C# projects when you need both JavaScript execution and proxy configuration?
Any suggestions or code examples would be really helpful. Thanks!
I’ve used Selenium WebDriver with ChromeDriver for this exact thing and it works great with proxies. Just configure the proxy through ChromeOptions before starting the driver. JavaScript runs perfectly since you’re using a real Chrome instance in headless mode. Watch out for proxy authentication though - I had trouble with SOCKS5 proxies at first but HTTP proxies fixed the connection issues. Performance’s been solid for loading pages and running scripts.
puppeteer sharp is def the way to go! just add your proxy settings in the launch options and it works like a charm. I’ve used it n it handles JS just fine, very smooth operation! good luck with your project!
Try Playwright for .NET - it’s got solid proxy support and handles JavaScript perfectly. I switched from other tools because setting up proxies is dead simple through browser context options. You can configure HTTP, HTTPS, and SOCKS proxies without any headaches. The docs are great and it’s way more reliable than other options when you’re scraping JS-heavy pages. Easy NuGet install and the API makes sense if you’ve used headless browsers before.