Skip to content

Commit

Permalink
release 4.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jun 8, 2023
1 parent adb0819 commit 7a49604
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 61 deletions.
1 change: 1 addition & 0 deletions owasp-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<suppress>
<filePath regex="true">.*guava-31\.1-jre\.jar</filePath>
<cve>CVE-2020-8908</cve>
<cve>CVE-2023-2976</cve>
</suppress>

<suppress>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>4.9.1</version>
<version>4.10.0</version>

<name>htmlunit-driver</name>
<description>WebDriver compatible driver for HtmlUnit headless browser</description>
Expand All @@ -18,7 +18,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>

<selenium.version>4.9.1</selenium.version>
<selenium.version>4.10.0</selenium.version>
<htmlunit.version>2.70.0</htmlunit.version>

<jetty.version>9.4.50.v20221201</jetty.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,9 @@ public Capabilities getCapabilities() {
final DesiredCapabilities capabilities = new DesiredCapabilities(HTMLUNIT.browserName(), "", Platform.ANY);

capabilities.setPlatform(Platform.getCurrent());
capabilities.setJavascriptEnabled(isJavascriptEnabled());
capabilities.setVersion(Version.getProductVersion());

capabilities.setCapability(HtmlUnitDriver.JAVASCRIPT_ENABLED, isJavascriptEnabled());
return capabilities;
}

Expand Down
117 changes: 59 additions & 58 deletions src/test/java/org/openqa/selenium/htmlunit/HtmlUnitDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,48 +243,6 @@ protected WebClient modifyWebClient(final WebClient client) {
};
}

@Test
public void ctorWebClientCapabilitiesJsTrue() {
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);
capabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, true);

new HtmlUnitDriver(capabilities) {
@Override
protected WebClient modifyWebClient(final WebClient client) {
assertEquals(BrowserVersion.getDefault(), client.getBrowserVersion());

assertTrue("client.getOptions().isJavaScriptEnabled() is false",
client.getOptions().isJavaScriptEnabled());
assertTrue("client.isJavaScriptEnabled() is false", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", client.isJavaScriptEngineEnabled());

return client;
}
};
}

@Test
public void ctorWebClientCapabilitiesJsFalse() {
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);
capabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, false);

new HtmlUnitDriver(capabilities) {
@Override
protected WebClient modifyWebClient(final WebClient client) {
assertEquals(BrowserVersion.getDefault(), client.getBrowserVersion());

assertFalse("client.getOptions().isJavaScriptEnabled() is true",
client.getOptions().isJavaScriptEnabled());
assertFalse("client.isJavaScriptEnabled() is true", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", client.isJavaScriptEngineEnabled());

return client;
}
};
}

@Test
public void ctorWebClientCapabilitiesVersionString() {
DesiredCapabilities capabilities = new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "firefox",
Expand Down Expand Up @@ -450,10 +408,56 @@ protected WebClient modifyWebClient(final WebClient client) {
}

@Test
public void ctorWebClientCapabilitiesJsEnabledTrue() {
public void ctorWebClientJsEnabledTrue() {
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);
capabilities.setJavascriptEnabled(true);

final HtmlUnitDriver driver = new HtmlUnitDriver(capabilities);
assertTrue("client.getOptions().isJavaScriptEnabled() is false", driver.isJavascriptEnabled());
assertTrue("client.getOptions().isJavaScriptEnabled() is true",
driver.getWebClient().getOptions().isJavaScriptEnabled());
assertTrue("client.isJavaScriptEnabled() is true", driver.getWebClient().isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", driver.getWebClient().isJavaScriptEngineEnabled());

driver.setJavascriptEnabled(false);
assertFalse("client.getOptions().isJavaScriptEnabled() is true", driver.isJavascriptEnabled());
assertFalse("client.getOptions().isJavaScriptEnabled() is true",
driver.getWebClient().getOptions().isJavaScriptEnabled());
assertFalse("client.isJavaScriptEnabled() is true", driver.getWebClient().isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", driver.getWebClient().isJavaScriptEngineEnabled());
}

@Test
public void ctorWebClientJsEnabledFalse() {
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);

final HtmlUnitDriver driver = new HtmlUnitDriver(capabilities) {
@Override
protected WebClient modifyWebClient(final WebClient client) {
assertEquals(BrowserVersion.getDefault(), client.getBrowserVersion());

client.getOptions().setJavaScriptEnabled(false);

return client;
}
};

assertFalse("client.getOptions().isJavaScriptEnabled() is true", driver.isJavascriptEnabled());
assertFalse("client.getOptions().isJavaScriptEnabled() is true",
driver.getWebClient().getOptions().isJavaScriptEnabled());
assertFalse("client.isJavaScriptEnabled() is true", driver.getWebClient().isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", driver.getWebClient().isJavaScriptEngineEnabled());
}

@Test
public void ctorWebClientCapabilitiesProxy() {
final Proxy proxy = new Proxy();
proxy.setHttpProxy("hostname:1234");

final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);
capabilities.setCapability(CapabilityType.PROXY, proxy);

new HtmlUnitDriver(capabilities) {
@Override
Expand All @@ -465,25 +469,28 @@ protected WebClient modifyWebClient(final WebClient client) {
assertTrue("client.isJavaScriptEnabled() is false", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", client.isJavaScriptEngineEnabled());

assertEquals("hostname", client.getOptions().getProxyConfig().getProxyHost());
assertEquals(1234, client.getOptions().getProxyConfig().getProxyPort());

return client;
}
};
}

@Test
public void ctorWebClientCapabilitiesJsEnabledFalse() {
public void ctorWebClientCapabilitiesJsTrue() {
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);
capabilities.setJavascriptEnabled(false);
capabilities.setCapability(HtmlUnitDriver.JAVASCRIPT_ENABLED, true);

new HtmlUnitDriver(capabilities) {
@Override
protected WebClient modifyWebClient(final WebClient client) {
assertEquals(BrowserVersion.getDefault(), client.getBrowserVersion());

assertFalse("client.getOptions().isJavaScriptEnabled() is true",
assertTrue("client.getOptions().isJavaScriptEnabled() is false",
client.getOptions().isJavaScriptEnabled());
assertFalse("client.isJavaScriptEnabled() is true", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEnabled() is false", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", client.isJavaScriptEngineEnabled());

return client;
Expand All @@ -492,27 +499,21 @@ protected WebClient modifyWebClient(final WebClient client) {
}

@Test
public void ctorWebClientCapabilitiesProxy() {
final Proxy proxy = new Proxy();
proxy.setHttpProxy("hostname:1234");

public void ctorWebClientCapabilitiesJsFalse() {
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.HTMLUNIT.browserName(), "", Platform.ANY);
capabilities.setCapability(CapabilityType.PROXY, proxy);
capabilities.setCapability(HtmlUnitDriver.JAVASCRIPT_ENABLED, false);

new HtmlUnitDriver(capabilities) {
@Override
protected WebClient modifyWebClient(final WebClient client) {
assertEquals(BrowserVersion.getDefault(), client.getBrowserVersion());

assertTrue("client.getOptions().isJavaScriptEnabled() is false",
assertFalse("client.getOptions().isJavaScriptEnabled() is true",
client.getOptions().isJavaScriptEnabled());
assertTrue("client.isJavaScriptEnabled() is false", client.isJavaScriptEnabled());
assertFalse("client.isJavaScriptEnabled() is true", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", client.isJavaScriptEngineEnabled());

assertEquals("hostname", client.getOptions().getProxyConfig().getProxyHost());
assertEquals(1234, client.getOptions().getProxyConfig().getProxyPort());

return client;
}
};
Expand Down

0 comments on commit 7a49604

Please sign in to comment.