Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions java/client/src/org/openqa/selenium/htmlunit/HtmlUnitDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,35 @@ public class HtmlUnitDriver implements WebDriver, JavascriptExecutor,
public static final String INVALIDSELECTIONERROR =
"The xpath expression '%s' selected an object of type '%s' instead of a WebElement";

/**
* Constructs a new instance with JavaScript disabled,
* and the {@link BrowserVersion#getDefault() default} BrowserVersion.
*/
public HtmlUnitDriver() {
this(false);
}

/**
* Constructs a new instance, specify JavaScript support
* and using the {@link BrowserVersion#getDefault() default} BrowserVersion.
*
* @param enableJavascript whether to enable JavaScript support or not
*/
public HtmlUnitDriver(boolean enableJavascript) {
this(BrowserVersion.getDefault(), enableJavascript);
}

/**
* Constructs a new instance with the specified {@link BrowserVersion} and the JavaScript support.
*
* @param version the browser version to use
* @param enableJavascript whether to enable JavaScript support or not
*/
public HtmlUnitDriver(BrowserVersion version, boolean enableJavascript) {
this(version);
setJavascriptEnabled(enableJavascript);
}

/**
* Constructs a new instance with the specified {@link BrowserVersion}.
*
Expand Down Expand Up @@ -197,25 +226,6 @@ public void webWindowClosed(WebWindowEvent event) {
resetKeyboardAndMouseState();
}

/**
* Constructs a new instance with JavaScript disabled,
* and the {@link BrowserVersion#getDefault() default} BrowserVersion.
*/
public HtmlUnitDriver() {
this(false);
}

/**
* Constructs a new instance, specify JavaScript support
* and using the {@link BrowserVersion#getDefault() default} BrowserVersion.
*
* @param enableJavascript whether to enable JavaScript support or not
*/
public HtmlUnitDriver(boolean enableJavascript) {
this(BrowserVersion.getDefault());
setJavascriptEnabled(enableJavascript);
}

/**
* Note: There are two configuration modes for the HtmlUnitDriver using this constructor.
* <ol>
Expand Down