i have been wondering for a while a way to provide proxy credentials for phantomJs in selenium webdriver in java after my own course of research i thought it is done but nevertheless i am still receiving 407(proxy issue) i have provided my code below for your kind review, help would be greatly appriciated
public class PhantomProxy {
private static PhantomJSDriverService service;
private static WebDriver webDriver;
protected static DesiredCapabilities dCaps;
public static void main(String[] args) {
String[]a={"--proxy=ip:10....(your proxy ip)","--proxy-auth=username:password"};
service = new PhantomJSDriverService.Builder()
.usingPhantomJSExecutable(new File("your own custom path\\phantomjs.exe"))
.usingCommandLineArguments(a).usingPort(6050).build();
service.start();
Capabilities caps = new DesiredCapabilities();
((DesiredCapabilities) caps).setJavascriptEnabled(true);
((DesiredCapabilities) caps).setCapability("takesScreenshot", true);
webDriver = new RemoteWebDriver(service.getUrl(), caps);
webDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
webDriver.get("http://www.google.com");
Thread.sleep(2000L);
String pageSource=webDriver.getPageSource();
System.out.println(pageSource);
webDriver.quit();
}
it is to be noted that the command line arguments works fine in command line interface but i completely have no idea why it doesn't works here