Package org.openqa.selenium.htmlunit

Examples of org.openqa.selenium.htmlunit.HtmlUnitDriver$HtmlUnitTimeouts


    return browser;
  }

  private EmbeddedBrowser newHtmlUnitBrowser(ImmutableSortedSet<String> filterAttributes,
          long crawlWaitReload, long crawlWaitEvent) {
    HtmlUnitDriver driverHtmlUnit = new HtmlUnitDriver(BrowserVersion.FIREFOX_17);
    driverHtmlUnit.setJavascriptEnabled(true);
    if (configuration.getProxyConfiguration() != null) {
      driverHtmlUnit.setProxy(configuration.getProxyConfiguration().getHostname(),
              configuration.getProxyConfiguration().getPort());
    }

    return WebDriverBackedEmbeddedBrowser.withDriver(driverHtmlUnit,
            filterAttributes, crawlWaitEvent, crawlWaitReload);
View Full Code Here


        WebDriver driver = null;
       
        logger.debug("Creating driver: " + driverType);
        if ("HtmlUnit".equals(driverType)) {
          boolean enableJavaScript = pc.get("ju-testing-ee.selenium.htmlUnit.enableJavascript", Boolean.class);
          driver = new HtmlUnitDriver(enableJavaScript);
        } else if ("Chrome".equals(driverType)) {
          System.setProperty("webdriver.chrome.driver", DriverRule.getChromeDriverExePath().toAbsolutePath().toString());
              driver = new ChromeDriver();
        } else {
          throw new JuRuntimeException(String.format("Unsupported selenium driver type: %s. Check value of property %s"
View Full Code Here

   */
  public static WebDriver buildDriver(String driverName) throws Exception {
    WebDriver driver = null;

    if (HTMLUNIT.equals(driverName)) {
      driver = new HtmlUnitDriver();
      ((HtmlUnitDriver) driver).setJavascriptEnabled(true);
    }

    if (FIREFOX.equals(driverName)) {
      driver = new FirefoxDriver();
View Full Code Here

    if (browser.indexOf(':') > -1) {
      // Use constants BrowserType.IE, BrowserType.FIREFOX, BrowserType.CHROME etc.
      String emulatedBrowser = browser.replaceFirst("htmlunit:(.*)", "$1");
      capabilities.setVersion(emulatedBrowser);
    }
    return new HtmlUnitDriver(capabilities);
  }
View Full Code Here

    else if ("htmlunit".equalsIgnoreCase(browser)) {
      DesiredCapabilities desiredCapabilities = DesiredCapabilities.htmlUnit();
      desiredCapabilities.setCapability(HtmlUnitDriver.INVALIDSELECTIONERROR, true);
      desiredCapabilities.setCapability(HtmlUnitDriver.INVALIDXPATHERROR, false);
      desiredCapabilities.setJavascriptEnabled(true);
      return new HtmlUnitDriver(desiredCapabilities);
    }
    else {
      return new FirefoxDriver();
    }
  }
View Full Code Here

        Map<String, List<String>> qunitSuiteNameTestsHM = new LinkedHashMap<String, List<String>>();

        final TestMethod[] qunitTestMethods = suite.getTestMethods();
        if (!ArrayUtils.isEmpty(qunitTestMethods)) {

            HtmlUnitDriver driver = new HtmlUnitDriver(true);

            for (TestMethod method : qunitTestMethods) {
                if (!StringUtils.isEmpty(method.getQUnitTestSuiteFilePath())) {

                    qunitSuiteNameTestsHM.put(method.getQUnitTestSuiteFilePath(), new ArrayList<String>());

                    final String qunitTestFilePath = (new StringBuilder()).append(QUnitConstants.TMP_FOLDER).append("/")
                            .append(archive.getName()).append("/").append(method.getQUnitTestSuiteFilePath()).toString();

                    URL url = new File(qunitTestFilePath).toURI().toURL();

                    driver.get(url.toExternalForm());

                    @SuppressWarnings("unchecked")
                    List<ConsString> qunitTestList = (List<ConsString>) driver.executeScript("return window.arquillianQUnitTests");

                    if (!CollectionUtils.isEmpty(qunitTestList)) {

                        for (ConsString moduleConsString : qunitTestList) {
View Full Code Here

        event.proceed();
    }

    protected WebDriver createWebDriver() {
        return new HtmlUnitDriver();
    }
View Full Code Here

    @Test
    public void shouldUseHeadlessBrowserToSubmitToGoogle() {
        // Create a new instance of the html unit driver
        // Notice that the remainder of the code relies on the interface,
        // not the implementation.
        WebDriver driver = new HtmlUnitDriver();

        // And now use this to visit Google
        driver.get("http://www.google.com");

        // Find the text input element by its name
        WebElement element = driver.findElement(By.name("q"));

        // Enter something to search for
        element.sendKeys("Cheese!");

        // Now submit the form. WebDriver will find the form for us from the element
        element.submit();

        // Check the title of the page
        System.out.println("Page title is: " + driver.getTitle());
    }
View Full Code Here

*/
public class HtmlUnitBrowser {
  private static Log log = LogFactory.getLog(FireFoxBrowser.class);
  public static WebDriver getDriver() {
    try {
      HtmlUnitDriver driver = new HtmlUnitDriver();
      driver.setJavascriptEnabled(true);
      return driver;
    } catch (Throwable th) {
      log.info(th.getMessage());
    }
    return new NullWebDriver();
View Full Code Here

    } else if (htmlUnit()) {
      DesiredCapabilities desiredCapabilities = DesiredCapabilities.htmlUnit();
      desiredCapabilities.setCapability(HtmlUnitDriver.INVALIDSELECTIONERROR, true);
      desiredCapabilities.setCapability(HtmlUnitDriver.INVALIDXPATHERROR, false);
      desiredCapabilities.setJavascriptEnabled(true);
      return new HtmlUnitDriver(desiredCapabilities);
    } else if (FIREFOX.equalsIgnoreCase(browser)) {
      return maximize(new FirefoxDriver());
    } else if (OPERA.equalsIgnoreCase(browser)) {
      return createInstanceOf("com.opera.core.systems.OperaDriver");
    } else {
View Full Code Here

TOP

Related Classes of org.openqa.selenium.htmlunit.HtmlUnitDriver$HtmlUnitTimeouts

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.