protected WebDriver getDriver() { if (this._driver == null) { DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability( PhantomJSDriverService.PHANTOMJS_PAGE_SETTINGS_PREFIX + "userAgent", spoofUserAgent); caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] { "--web-security=false", "--ssl-protocol=any", "--ignore-ssl-errors=true", "--webdriver-loglevel=INFO" }); PhantomJSDriverService service = new PhantomJSDriverService.Builder() .usingPort(8080) .usingPhantomJSExecutable(new File("/usr/local/bin/phantomjs")) .build(); this._driver = new PhantomJSDriver(service, caps); } return this._driver; }
public PhantomJSDriverService.Builder createPhantomJsDriverServiceBuilder(SiteConfig siteConfig, DriverConfig driverConfig, File driverFile) { PhantomJSDriverService.Builder serviceBuilder = new PhantomJSDriverService.Builder(); serviceBuilder.usingPhantomJSExecutable(driverFile); // serviceBuilder.usingAnyFreePort(); // serviceBuilder.withEnvironment(Map<String, String>); // serviceBuilder.withLogFile(File); // serviceBuilder.usingPort(int); // // serviceBuilder.withProxy(Proxy); // serviceBuilder.usingGhostDriver(File); // serviceBuilder.usingCommandLineArguments(String[]); // serviceBuilder.usingGhostDriverCommandLineArguments(String[]); return serviceBuilder; }
/** * Generates a phantomJs webdriver. * * @return * A phantomJs webdriver * @throws TechnicalException * if an error occured when Webdriver setExecutable to true. */ private WebDriver generatePhantomJsDriver() throws TechnicalException { final String pathWebdriver = DriverFactory.getPath(Driver.PHANTOMJS); if (!new File(pathWebdriver).setExecutable(true)) { throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE)); } logger.info("Generating Phantomjs driver ({}) ...", pathWebdriver); final DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_PAGE_CUSTOMHEADERS_PREFIX + "Accept-Language", "fr-FR"); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, pathWebdriver); capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT); capabilities.setJavascriptEnabled(true); setLoggingLevel(capabilities); // Proxy configuration String proxy = ""; if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) { proxy = Context.getProxy().getHttpProxy(); } capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] { "--proxy=" + proxy, "--web-security=no", "--ignore-ssl-errors=true", "--ssl-protocol=tlsv1", "--webdriver-loglevel=NONE" }); return new PhantomJSDriver(capabilities); }
private static WebDriver createPhantomJSDriver(String driverPath) { DesiredCapabilities desiredCapabilities = DesiredCapabilities.phantomjs(); desiredCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, driverPath); desiredCapabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, true); desiredCapabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true); desiredCapabilities.setCapability(CapabilityType.ENABLE_PROFILING_CAPABILITY, true); desiredCapabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, true); desiredCapabilities.setJavascriptEnabled(true); ArrayList<String> cliArgs = new ArrayList<String>(); cliArgs.add("--web-security=true"); cliArgs.add("--ignore-ssl-errors=true"); desiredCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgs); return new PhantomJSDriver(desiredCapabilities); }
PwnBackWebDriver(PwnBackMediator mediator) { this.mediator = mediator; PhantomJSDriverService driverService = new PhantomJSDriverService.Builder() .usingPhantomJSExecutable(new File(PwnBackSettings.phatomjsLocation)) .build(); DesiredCapabilities capability = new DesiredCapabilities(); capability.setCapability("takesScreenshot", false); String[] args = new String[1]; args[0] = ""; if (checkSSLCertPathDefined()) { args[0] = "--ssl-certificates-path=" + PwnBackSettings.caBundleLocation; } capability.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, args); capability.setCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0"); driver = new PhantomJSDriver(driverService, capability); }
@Override public void onTrigger(ProcessContext context, ProcessSession session) { DesiredCapabilities DesireCaps = new DesiredCapabilities(); DesireCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, context.getProperty(DRIVER_LOCATION).getValue()); driver = new PhantomJSDriver(DesireCaps); FlowFile flowFile = session.create(); try { driver.get(url); (new WebDriverWait(driver, timeout)).until( ExpectedConditions.visibilityOfElementLocated(getExpectedCondition(selectorType, selector)) ); final byte[] page = formatToXHtml(driver.getPageSource(), StandardCharsets.UTF_8); flowFile = session.write(flowFile, outputStream -> outputStream.write(page)); session.transfer(flowFile, REL_SUCCESS); } catch (Exception e) { flowFile = session.write(flowFile, outputStream -> outputStream.write(e.getMessage().getBytes())); session.transfer(flowFile, REL_FAILURE); } finally { driver.quit(); } session.getProvenanceReporter().create(flowFile); }
public static PhantomJSDriverService createDefaultService(Capabilities desiredCapabilities, Map<String, String> env) { Proxy proxy = null; if (desiredCapabilities != null) { proxy = Proxy.extractFrom(desiredCapabilities); } File phantomjsfile = findPhantomJS(desiredCapabilities, "https://github.com/ariya/phantomjs/wiki", "http://phantomjs.org/download.html"); File ghostDriverfile = findGhostDriver(desiredCapabilities, "https://github.com/detro/ghostdriver/blob/master/README.md", "https://github.com/detro/ghostdriver/downloads"); Builder builder = new Builder(); builder.usingPhantomJSExecutable(phantomjsfile) .usingGhostDriver(ghostDriverfile) .usingAnyFreePort() .withProxy(proxy) .withLogFile(new File("phantomjsdriver.log")) .usingCommandLineArguments(findCLIArgumentsFromCaps(desiredCapabilities, "phantomjs.cli.args")) .usingGhostDriverCommandLineArguments(findCLIArgumentsFromCaps(desiredCapabilities, "phantomjs.ghostdriver.cli.args")); if(null != env) builder.withEnvironment(env); return builder.build(); }
public PhantomJSDriverService createService(String... arguments) { List<String> argList = new ArrayList<>(); argList.add("--web-security=false"); argList.add("--webdriver-loglevel=TRACE"); argList.add("--load-images=false"); argList.add("--ignore-ssl-errors=true"); argList.add("--ssl-protocol=any"); argList.addAll(Arrays.asList(arguments)); PhantomJSDriverService service = new PhantomJSDriverService.Builder() .usingPhantomJSExecutable(EXECUTABLE) .usingCommandLineArguments(argList.toArray(new String[argList.size()])) .usingAnyFreePort() .build(); LoggingOutputStream loggingOutputStream = new LoggingOutputStream(log, LogLevel.INFO); service.sendOutputTo(loggingOutputStream); return service; }
@Test public void startAndStop() throws IOException { PhantomJSDriverService driverService = factory.createService(); driverService.start(); try { WebDriver webDriver = factory.createWebDriver(driverService); String url = "http://localhost:" + httpServer.getAddress().getPort() + "/webdriverTest"; webDriver.get(url); String currentUrl = webDriver.getCurrentUrl(); assertThat(currentUrl).isEqualTo(url); } finally { driverService.stop(); } }
@Ignore @Test public void testProxyHTTP() throws IOException { String[] arguments = factory.createServiceArgumentsBuilder() .httpProxyServer("http://localhost:" + proxyPortProber.getPort()) .build(); PhantomJSDriverService service = factory.createService(arguments); service.start(); try { WebDriver webDriver = factory.createWebDriver(service); webDriver.get("http://www.lgohlke.de"); assertThat(webDriver.getPageSource().length()).isBetween(24000, 26000); } finally { service.stop(); } }
@Ignore @Test public void testProxyHTTPS() throws IOException { String[] arguments = factory.createServiceArgumentsBuilder() .httpProxyServer("http://localhost:" + proxyPortProber.getPort()) .build(); PhantomJSDriverService service = factory.createService(arguments); service.start(); try { WebDriver webDriver = factory.createWebDriver(service); webDriver.get("https://www.google.de"); assertThat(webDriver.getPageSource().length()).isBetween(100000, 110000); } finally { service.stop(); } }
@Test public void testSeleniumGhostDriver() { File phantomjs = Phanbedder.unpack(); DesiredCapabilities dcaps = new DesiredCapabilities(); dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath()); PhantomJSDriver driver = new PhantomJSDriver(dcaps); try { driver.get("https://www.google.com"); WebElement query = driver.findElement(By.name("q")); query.sendKeys("Phanbedder"); query.submit(); Assertions.assertThat(driver.getTitle()).contains("Phanbedder"); } finally { driver.quit(); } }
private static DesiredCapabilities initBrowserCapabilities() { DesiredCapabilities browserCapabilities = new DesiredCapabilities(); browserCapabilities.setJavascriptEnabled(true); if (StringUtils.isNotEmpty(PHANTOM_JS_PATH_PROP)) { System.out.printf("\n\nSetting Phantom JS path to %s\n\n%n", PHANTOM_JS_PATH_PROP); browserCapabilities.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, PHANTOM_JS_PATH_PROP); } browserCapabilities.setCapability("takesScreenshot", true); browserCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, buildPhantomJsCommandLineArguments()); browserCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_CLI_ARGS, new String[]{ formatArgument(LOG_LEVEL_ARG, ERROR) }); return browserCapabilities; }
/** * PhantomJS bean * @param capabilities Desirercapabilities for WebDriver * @return WebDriver instance */ @Bean(name="phantomJS") @Lazy(true) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public WebDriver phantomJS(DesiredCapabilities capabilities){ DesiredCapabilities phantomJSCap = new DesiredCapabilities(); phantomJSCap.setJavascriptEnabled(true); try { phantomJSCap.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, URLDecoder.decode(getClass() .getClassLoader().getResource(".").getPath(), "UTF-8")+System.getProperty("file.separator")+"downloads"+System.getProperty("file.separator")+"phantomjs-2.0.0-windows"+System.getProperty("file" + ".separator")+"phantomjs.exe"); } catch (UnsupportedEncodingException e) { log.error("Exception occured constructing path to executable: {}", e); } phantomJSCap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[]{ "--ignore-ssl-errors=yes", "--web-security=false", "--ssl-protocol=any"}); phantomJSCap.setCapability(PhantomJSDriverService.PHANTOMJS_PAGE_SETTINGS_PREFIX, "Y"); phantomJSCap.setCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); phantomJSCap.setCapability("elementScrollBehavior",1); return new PhantomJSDriver(capabilities.merge(phantomJSCap)); }
public static void main(String[] args) { //设置相应的驱动程序的位置 System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, "F:\\selenium\\chromedriver.exe"); System.setProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "F:\\selenium\\phantomjs.exe"); //任务执行线程池大小 int threadCount = 5; SpiderConfig spiderConfig = SpiderConfig.create("baidu", threadCount) .setEmptySleepMillis(1000) .setExitWhenComplete(true); SiteConfig siteConfig = SiteConfig.create() .setMaxConnTotal(200) .setMaxConnPerRoute(100); //定义WebDriver池 WebDriverPool webDriverPool = new WebDriverPool( new WebDriverFactory(), new DefaultWebDriverChooser(DriverType.CHROME), threadCount); //使用WebDriverDownloader请求任务下载器 Downloader downloader = new WebDriverDownloader(webDriverPool); Spider spider = Spider.create(spiderConfig, siteConfig, new BaiduPageProcessor()) .setDownloader(downloader) //设置请求任务下载器 .setPipeline(new BaiduPipeline()) .addStartRequests("https://www.baidu.com/s?wd=https"); //监控 SpiderMonitor.register(spider); //启动 spider.start(); }
public static DesiredCapabilities getDefaultDesiredCapabilities() { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setJavascriptEnabled(true); capabilities.setCapability("acceptSslCerts", true); capabilities.setCapability("takesScreenshot", true); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, asList("--ignore-ssl-errors=true")); LoggingPreferences loggingPreferences = new LoggingPreferences(); loggingPreferences.enable(LogType.BROWSER, Level.ALL); capabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences); return capabilities; }
/** * * @param poolsize * @param loadImg * 是否加载图片,默认不加载 */ public PhantomjsWebDriverPool(int poolsize, boolean loadImg, String phantomjsPath) { this.CAPACITY = poolsize; innerQueue = new LinkedBlockingDeque<WebDriver>(poolsize); PHANTOMJS_PATH = phantomjsPath; caps.setJavascriptEnabled(true); caps.setCapability("webStorageEnabled", true); caps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, PHANTOMJS_PATH); // caps.setCapability("takesScreenshot", false); caps.setCapability( PhantomJSDriverService.PHANTOMJS_PAGE_CUSTOMHEADERS_PREFIX + "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"); ArrayList<String> cliArgsCap = new ArrayList<String>(); // http://phantomjs.org/api/command-line.html cliArgsCap.add("--web-security=false"); cliArgsCap.add("--ssl-protocol=any"); cliArgsCap.add("--ignore-ssl-errors=true"); if (loadImg) { cliArgsCap.add("--load-images=true"); } else { cliArgsCap.add("--load-images=false"); } caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap); caps.setCapability( PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_CLI_ARGS, new String[] { "--logLevel=INFO" }); }
public PhantomJSDriverService getPhantomJsService() { return new PhantomJSDriverService.Builder() .usingAnyFreePort() .usingPhantomJSExecutable( new File(ResourceHelper .getResourcePath("driver/phantomjs.exe"))) .withLogFile( new File(ResourceHelper .getResourcePath("logs/phantomjslogs/") + "phantomjslogs" + DateTimeHelper.getCurrentDateTime() + ".log")) .build(); }
private static DesiredCapabilities getPhantomCapabilities(Locale lang) { DesiredCapabilities capabilities = DesiredCapabilities.phantomjs(); String value = lang.getLanguage().toLowerCase(); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_PAGE_CUSTOMHEADERS_PREFIX + "Accept-Language", value); capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE); return capabilities; }
/** * Use phantomjs to fetch the web content. * @return */ protected WebDriver phantomJsDriver() { String phantomJsExecPath = System.getProperty("phantomjsExec"); if(phantomJsExecPath == null || "".equals(phantomJsExecPath)) { phantomJsExecPath = "/usr/local/bin/phantomjs"; } DesiredCapabilities dc = new DesiredCapabilities(); dc.setJavascriptEnabled(true); dc.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJsExecPath ); return new PhantomJSDriver(dc); }
private static WebDriver getPhantomJsDriver() { final DesiredCapabilities caps = DesiredCapabilities.phantomjs(); caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] { "--ignore-ssl-errors=true", "--ssl-protocol=tlsv1", "--web-security=false" }); final PhantomJSDriver phantomJSDriver = new PhantomJSDriver(caps); phantomJSDriver.manage().window().setSize(new Dimension(1280, 800)); return phantomJSDriver; }
@BeforeClass public static void setupEnv() throws IOException { String phantomJSPath = System.getProperty("phantomjs.binary"); File phantomJSExec = new File(phantomJSPath); service = new PhantomJSDriverService.Builder().usingPhantomJSExecutable(phantomJSExec).build(); service.start(); }
/** * Setting up PhantoJSDriver * * @return PhantomJSDriver */ public static WebDriver setUpPhantomJSDriver(String driverPath) { File phantomjs = new File(driverPath); DesiredCapabilities dcaps = new DesiredCapabilities(); dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[]{"--ignore-ssl-errors=yes", "--ssl-protocol=tlsv1", "version=2.0", "driverVersion=1.2.0"}); dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath()); return new PhantomJSDriver(dcaps); }
/** * Default implementation throws UnsupportedOperationException * @return WebDriver instance */ protected WebDriver getPhantomJsWebDriver() { String pathToBin = getOsSpecificBinaryPathFromProp(PHANTOM_JS_BIN_PROP, "phantomjs"); DesiredCapabilities capabilities = getPhantomJsCapabilities(); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, pathToBin); return new PhantomJSDriver(capabilities); }
@Override public void before() { File phantomjs = Phanbedder.unpack(); DesiredCapabilities dcaps = new DesiredCapabilities(); dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath()); driver = new PhantomJSDriver(dcaps); }
public WebDriver get() { File phantomJsExe = new File("phantomjs-1.9.7-windows/phantomjs.exe"); Map<String, Object> caps = new HashMap<>(); caps.put(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJsExe.getAbsolutePath()); DesiredCapabilities capabilities = new DesiredCapabilities(caps); WebDriver driver = new PhantomJSDriver(capabilities); Dimension DEFAULT_WINDOW_SIZE = new Dimension(1024, 768); driver.manage().window().setSize(DEFAULT_WINDOW_SIZE); return driver; }
@Override public WebDriver getWebDriver() { DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "src/test/resources/phantomjs"); caps.setCapability("takesScreenshot", true); return new PhantomJSDriver(caps); }
private static Capabilities configWebDriver() { DesiredCapabilities dCaps = new DesiredCapabilities(); dCaps.setCapability("takesScreenshot", true); dCaps.setCapability( PhantomJSDriverService.PHANTOMJS_PAGE_SETTINGS_PREFIX + "userAgent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53 (KHTML, like Gecko) Chrome/15.0.87" ); dCaps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "path_to_phantom_js" ); return dCaps; }
private WebDriver createWebDriver() { final DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability("takesScreenshot", true); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, preparePhantomJSExecutable()); final WebDriver driver = new PhantomJSDriver(caps); return driver; }
@Override public DriverService createDriverService() { Builder builder = new PhantomJSDriverService.Builder(); if (driverExecutable != null) builder.usingPhantomJSExecutable(driverExecutable); if (ghostDriver != null) builder.usingGhostDriver(ghostDriver); if (port != null) builder.usingPort(port); if (environment != null) builder.withEnvironment(environment); if (logFile != null) builder.withLogFile(logFile); if (proxy != null) builder.withProxy(new Proxy(proxy)); if (commandLineArguments != null) builder.usingCommandLineArguments(commandLineArguments); if (ghostDriverCommandLineArguments != null) builder.usingGhostDriverCommandLineArguments(ghostDriverCommandLineArguments); return builder.build(); }
/** * * @param config * @return A FirefoxDriver. */ @Override public RemoteWebDriver make(HashMap<String, String> config) { DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); if (System.getProperty(PHANTOMJS_PATH_PROPERTY) != null) { path = System.getProperty(PHANTOMJS_PATH_PROPERTY); } caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, path); return new PhantomJSDriver(caps); }
@Override public PhantomJSDriver initialize() { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] { "--webdriver-loglevel=NONE", "--ignore-ssl-errors=true" }); return new PhantomJSDriver(capabilities); }
public WebDriverEx createPhantomJsWebDriver(SiteConfig siteConfig, DriverConfig driverConfig) throws IOException { File driverFile = createDriverFile(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY); DesiredCapabilities desiredCapabilities = createPhantomJsDesiredCapabilities(siteConfig, driverConfig); PhantomJSDriverService driverService = createPhantomJsDriverService(siteConfig, driverConfig, driverFile); return createWebDriver(driverService, desiredCapabilities, siteConfig, driverConfig); }
public PhantomJSDriverService createPhantomJsDriverService(SiteConfig siteConfig, DriverConfig driverConfig, File driverFile) { return createPhantomJsDriverServiceBuilder(siteConfig, driverConfig, driverFile).build(); }
/** * {@inheritDoc} */ @Override public String getPathProperty() { return PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY; }
public WebDriver getPhantomJsDriver(PhantomJSDriverService sev, Capabilities cap) { return new PhantomJSDriver(sev, cap); }
public WebDriver getPhantomJsDriver(String hubUrl,PhantomJSDriverService sev, Capabilities cap) throws MalformedURLException { return new RemoteWebDriver(new URL(hubUrl), cap); }