@Override
public WebDriver newInstance(DriverOptions driverOptions) {
DesiredCapabilities caps = setupProxy(DesiredCapabilities.phantomjs(), driverOptions);
if (driverOptions.has(PHANTOMJS)) {
File binary = new File(driverOptions.get(PHANTOMJS));
if (!binary.canExecute())
throw new IllegalArgumentException("Missing PhantomJS binary: " + binary);
caps.setCapability(PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary.getPath());
}
caps.merge(driverOptions.getCapabilities());
if (driverOptions.has(CLI_ARGS)) {