Package org.openqa.selenium.htmlunit

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


   */
  public Selenium create() {
    return new WebDriverBackedSelenium(new Supplier<WebDriver>() {
      public WebDriver get() {
        if (HtmlUnitDriver.class.isAssignableFrom(webDriverClass)) {
          return new HtmlUnitDriver(true);
        } else {
          try {
            return webDriverClass.newInstance();
          } catch (Exception e) {
            return null;
View Full Code Here



    private static void GetAPI(String username, String password)
        throws IOException
    {
        HtmlUnitDriver driver = new HtmlUnitDriver();
        driver.get(authUrlObject.toString());

        List<WebElement> webElements = driver.findElementsByTagName("form");

        WebElement usernameElement = driver.findElementById("username");
        usernameElement.sendKeys(username);
        WebElement passwordElement = driver.findElementById("password");
        passwordElement.sendKeys(password);
        webElements.get(0).submit();

        CodeUrl codeUrl = new CodeUrl(driver.getCurrentUrl());

        accessGrant = connectionFactory.getOAuthOperations().exchangeForAccess(codeUrl.getQueryMap().get(CodeUrl.CODE), REDIRECT_URI, null);

        connection = connectionFactory.createConnection(accessGrant);
        alfresco = connection.getApi();
View Full Code Here

    assertSame(driver, WebDriverRunner.getWebDriver());
  }

  @Test
  public void allowsToSpecifyCustomWebDriverProgrammatically() {
    HtmlUnitDriver myDriver = new HtmlUnitDriver(true);
    WebDriverRunner.setWebDriver(myDriver);

    open(url);
    assertSame(myDriver, WebDriverRunner.getWebDriver());
  }
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

    public WebDriver newInternetExplorerDriver(Capabilities capabilities) {
        return new InternetExplorerDriver(capabilities);
    }

    public WebDriver newHtmlUnitDriver(Capabilities capabilities) {
        return new HtmlUnitDriver(capabilities);
    }
View Full Code Here

    private static WebDriver driver;
    private static Pages pageFactory;

    @BeforeClass
    public static void open_local_static_site() {
        driver = new HtmlUnitDriver();
        pageFactory = new Pages(driver);
        openStaticTestSite(driver);
    }
View Full Code Here

    Configuration configuration;

    @Before
    public void openLocalStaticSite() {
        driver = new HtmlUnitDriver();
        openStaticTestSite();
        indexPage = new IndexPage(driver, 1);
        indexPage.setWaitForTimeout(100);
    }
View Full Code Here

    }


    @Test
    public void should_activate_javascript_support_in_htmlunit() {
        HtmlUnitDriver driver = mock(HtmlUnitDriver.class);

        JavascriptSupport.activateJavascriptSupportFor(driver);
       
        verify(driver).setJavascriptEnabled(true);
    }
View Full Code Here

    @Test
    public void the_proxied_webdriver_should_be_accessible_if_required() {
        WebDriver driver = WebdriverProxyFactory.getFactory().proxyFor(HtmlUnitDriver.class);

        HtmlUnitDriver proxiedDriver = (HtmlUnitDriver) ((WebDriverFacade) driver).getProxiedDriver();

        assertThat(proxiedDriver, is(notNullValue()));
        assertThat(HtmlUnitDriver.class.isAssignableFrom(proxiedDriver.getClass()), is(true));
    }
View Full Code Here

        final DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability(CapabilityType.PROXY, proxy);
        desiredCapabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, true);
        desiredCapabilities.setBrowserName(BrowserType.FIREFOX);

        driver = new HtmlUnitDriver(desiredCapabilities) {
            @Override
            protected WebClient newWebClient(final BrowserVersion version) {
                config.setBrowserVersion(version);
                return WebClientFactory.newInstance(config);
            }
View Full Code Here

TOP

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

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.