Java Code Examples for org.openqa.selenium.remote.DesiredCapabilities.htmlUnit()

The following are Jave code examples for showing how to use htmlUnit() of the org.openqa.selenium.remote.DesiredCapabilities class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: NoraUi   File:   Source Code and License Vote up 6 votes
 * Generates a htmlunit webdriver.
 * @return
 *         A htmlunit webdriver
private WebDriver generateHtmlUnitDriver() {"Generating HtmlUnit driver...");
    final DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
    capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
    capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);


    // Proxy configuration
    if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
        capabilities.setCapability(CapabilityType.PROXY, Context.getProxy());
    return new HtmlUnitDriver(capabilities);
Example 2
Project: vu-timetable   File:   Source Code and License Vote up 4 votes
public Crawler(final String courseName) {
    this.courseName = courseName;
    DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
    driver = new HtmlUnitDriver(capabilities);