/** * Creates a new PhantomJSDriver instance. * * @param desiredCapabilities The capabilities required from PhantomJS/GhostDriver. * @see org.openqa.selenium.phantomjs.PhantomJSDriverService#createDefaultService() for configuration details. */ public PhantomJSDriver(Capabilities desiredCapabilities) { this(PhantomJSDriverService.createDefaultService(desiredCapabilities), desiredCapabilities); }
File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK); .usingAnyFreePort() .withProxy(proxy) .withLogFile(findLogFile()) .withAcceptSslCerts(findAcceptSslCerts(desiredCapabilities)) .usingCommandLineArguments( findCLIArgumentsFromCaps(desiredCapabilities, PHANTOMJS_CLI_ARGS)) .usingGhostDriverCommandLineArguments( findCLIArgumentsFromCaps(desiredCapabilities, PHANTOMJS_GHOSTDRIVER_CLI_ARGS)) .build();
/** * Creates a new MultiSessionCommandExecutor. * The PhantomJSCommandExecutor will communicate with the PhantomJS/GhostDriver through the given {@code service}. * * @param service The PhantomJSDriverService to send commands to. */ public MultiSessionCommandExecutor(PhantomJSDriverService service) { super(PhantomJSDriver.getCustomCommands(), service.getUrl()); } }
public Response execute(Command command) throws IOException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { service.start(); if (rootCause instanceof ConnectException && "Connection refused".equals(rootCause.getMessage()) && !service.isRunning()) { throw new WebDriverException("The PhantomJS/GhostDriver server has unexpectedly died!", t); } finally { if (DriverCommand.QUIT.equals(command.getName())) { service.stop();
File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK); .withLogFile(new File(PHANTOMJS_DEFAULT_LOGFILE)) .usingCommandLineArguments( findCLIArgumentsFromCaps(desiredCapabilities, PHANTOMJS_CLI_ARGS)) .usingGhostDriverCommandLineArguments( findCLIArgumentsFromCaps(desiredCapabilities, PHANTOMJS_GHOSTDRIVER_CLI_ARGS)) .build();
File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK);
checkExecutable(phantomjs); return phantomjs;
return new PhantomJSDriverService(phantomjs, port, argsBuilder.build(), environment); } catch (IOException e) { throw new WebDriverException(e);
public Response execute(Command command) throws IOException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { service.start(); if (rootCause instanceof ConnectException && "Connection refused".equals(rootCause.getMessage()) && !service.isRunning()) { throw new WebDriverException("The PhantomJS/GhostDriver server has unexpectedly died!", t); } finally { if (DriverCommand.QUIT.equals(command.getName())) { service.stop();
checkExecutable(phantomjs); return phantomjs;
return new PhantomJSDriverService(phantomjs, port, argsBuilder.build(), environment); } catch (IOException e) { throw new WebDriverException(e);
/** * Same as {@link PhantomJSDriverService#createDefaultService(org.openqa.selenium.Capabilities)}. * <br> * In this case PhantomJS or GhostDriver can't be searched within the Capabilities, only System * Properties. * * @return A new ChromeDriverService using the default configuration. */ public static PhantomJSDriverService createDefaultService() { return createDefaultService(null); }
/** * Creates a new PhantomJSCommandExecutor. * The PhantomJSCommandExecutor will communicate with the PhantomJS/GhostDriver through the given {@code service}. * * @param service The PhantomJSDriverService to send commands to. */ PhantomJSCommandExecutor(PhantomJSDriverService service) { super(PhantomJSDriver.getCustomCommands(), service.getUrl()); this.service = service; }
/** * Same as {@link PhantomJSDriverService#createDefaultService(org.openqa.selenium.Capabilities)}. * <p/> * In this case PhantomJS or GhostDriver can't be searched within the Capabilities, only System * Properties. * * @return A new ChromeDriverService using the default configuration. */ public static PhantomJSDriverService createDefaultService() { return createDefaultService(null); }
/** * Creates a new MultiSessionCommandExecutor. * The PhantomJSCommandExecutor will communicate with the PhantomJS/GhostDriver through the given {@code service}. * * @param service The PhantomJSDriverService to send commands to. */ public MultiSessionCommandExecutor(PhantomJSDriverService service) { super(PhantomJSDriver.getCustomCommands(), service.getUrl()); } }
/** * Creates a new PhantomJSDriver instance. * * @param desiredCapabilities The capabilities required from PhantomJS/GhostDriver. * @see org.openqa.selenium.phantomjs.PhantomJSDriverService#createDefaultService() for configuration details. */ public FastPhantomJSDriver(Capabilities desiredCapabilities) { this(PhantomJSDriverService.createDefaultService(desiredCapabilities), desiredCapabilities); }
/** * Creates a new PhantomJSCommandExecutor. * The PhantomJSCommandExecutor will communicate with the PhantomJS/GhostDriver through the given {@code service}. * * @param service The PhantomJSDriverService to send commands to. */ PhantomJSCommandExecutor(PhantomJSDriverService service) { super(PhantomJSDriver.getCustomCommands(), service.getUrl()); this.service = service; }
/** * Creates a new PhantomJSDriver instance. * * @param desiredCapabilities The capabilities required from PhantomJS/GhostDriver. * @see org.openqa.selenium.phantomjs.PhantomJSDriverService#createDefaultService() for configuration details. */ public PhantomJSDriver(Capabilities desiredCapabilities) { this(PhantomJSDriverService.createDefaultService(desiredCapabilities), desiredCapabilities); }
@Override public PhantomJSDriver createInstance(WebDriverConfiguration configuration) { Capabilities capabilities = getCapabilities(configuration, true); PhantomJSDriverService phantomJSDriverService = PhantomJSDriverService.createDefaultService(capabilities); return SecurityActions.newInstance(configuration.getImplementationClass(), new Class<?>[] {PhantomJSDriverService.class, Capabilities.class}, new Object[] {phantomJSDriverService, capabilities}, PhantomJSDriver.class); }