Example usage for org.openqa.selenium.remote BrowserType PHANTOMJS

List of usage examples for org.openqa.selenium.remote BrowserType PHANTOMJS

Introduction

In this page you can find the example usage for org.openqa.selenium.remote BrowserType PHANTOMJS.

Prototype

String PHANTOMJS

To view the source code for org.openqa.selenium.remote BrowserType PHANTOMJS.

Click Source Link

Usage

From source file:com.vaadin.testbench.parallel.BrowserUtil.java

/**
 * @param capabilities//w w w  . ja  v a  2  s  .c  o  m
 *            The capabilities to check
 * @return true if the capabilities refer to PhantomJS, false otherwise
 */
public static boolean isPhantomJS(Capabilities capabilities) {
    if (capabilities == null) {
        return false;
    }
    return BrowserType.PHANTOMJS.equals(capabilities.getBrowserName());
}

From source file:com.vilt.minium.script.impl.PhantomJsDriverFactory.java

License:Apache License

@Override
public WebDriver create(DesiredCapabilities capabilities) {
    Preconditions.checkArgument(Objects.equal(BrowserType.PHANTOMJS, capabilities.getBrowserName()));
    maybeInitPhantomJsDriverService();//  w w  w.j a  v  a 2s.  c  o  m
    WebDriver driver = new RemoteWebDriver(service.getUrl(), capabilities);
    return new Augmenter().augment(driver);
}

From source file:com.vilt.minium.script.WebElementsDriverFactory.java

License:Apache License

public WebElementsDriverFactory(AppPreferences preferences,
        Class<? extends WebElements>... additionalInterfaces) {
    this.additionalInterfaces = additionalInterfaces;

    driverFactories.put(BrowserType.CHROME, new ChromeDriverFactory(preferences));
    driverFactories.put(BrowserType.FIREFOX, new FirefoxDriverFactory());
    driverFactories.put(BrowserType.IE, new InternetExplorerDriverFactory(preferences));
    driverFactories.put(BrowserType.SAFARI, new SafariDriverFactory());
    driverFactories.put(BrowserType.PHANTOMJS, new PhantomJsDriverFactory(preferences));
}

From source file:testbench.org.rapidpm.jumpstart.vaadin.ui.BaseTestbenchTest.java

License:Apache License

public void setUpTestbench() throws Exception {

    //    System.setProperty("phantomjs.binary.path", "/Users/svenruppert/Applications/phantomjs-2.0.0-macosx/bin/phantomjs");

    remoteWebDriver = getRemoteWebDriver();
    // Create a new Selenium driver - it is automatically extended to work
    // with TestBench
    setDriver(remoteWebDriver);//from  w  ww  .ja  v  a  2s  . co m
    //    setDriver(new PhantomJSDriver());

    // Open the test application URL with the ?restartApplication URL
    // parameter to ensure Vaadin provides us with a fresh UI instance.
    getDriver().get(baseUrl + "?restartApplication");
    if (remoteWebDriver.getCapabilities().getBrowserName().equals(BrowserType.PHANTOMJS)) {
        getTestBenchCommandExecutor().resizeViewPortTo(1280, 768);
    }

    getTestBenchCommandExecutor().enableWaitForVaadin();

    // If you deploy using WTP in Eclipse, this will fail. You should
    // update baseUrl to point to where the app is deployed.
    String pageSource = getDriver().getPageSource();
    String errorMsg = "Application is not available at " + baseUrl + ". Server not started?";
    Assert.assertFalse(errorMsg, pageSource.contains("HTTP Status 404")
            || pageSource.contains("can't establish a connection to the server"));
}

From source file:testinfrastructure.testutils.DriverInTest.java

License:Apache License

public static boolean isPhantomJSDriver(WebDriver webDriver) {
    return isDriver(webDriver, PhantomJSDriver.class, BrowserType.PHANTOMJS);
}