Hello,
I have been using a headless browser to generate screenshots of various WebPages, and it's been working perfectly.
This is what the working code:
DesiredCapabilities chrome = DesiredCapabilities.chrome();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--window-size=1400,900");
chrome.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
I am able to retrieve the content of a page, and generate a screenshot fine.
However, I need to make a change, and use a socks5 proxy.
Once I add a "--proxy-server" to the list of arguments, everything breaks
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--proxy-server=socks5://localhost:xxxx");
(Where xxxx is the port my socks proxy is at - This is working perfectly outside of selenium, or when I launch Chrome through terminal with the --proxy-server=socks5://localhost:xxxx flag)
chromeOptions.addArguments("--window-size=1400,900");
chrome.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
This just has Selenium hanging, and throwing an exception
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.10.13-1-ARCH x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.01 seconds
Any idea on what might be going on / how to fix it?
Selenium Standalone 3.4
ChromeDriver 2.29
Thanks!