Java
1
Вклад в тег
caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
Config.dir + "//browser//phantomjs");
String user = Config.PROXY_CREDENTIALS.get("user");
String password = Config.PROXY_CREDENTIALS.get("password");
// create screen
caps.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
// use proxy
proxy = Config.getProxy();
caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] { "--load-images=false",
"--proxy=" + proxy, String.format("--proxy-auth=%s:%s", user, password) });
// use user agent
caps.setCapability("phantomjs.page.settings.userAgent", Config.getUserAgent());
try {
// create phantomjs
driver = new PhantomJSDriver(caps);