Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let HtmlUnitDriver be chosen as a substitute to Selenium WebDriver #500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Crydust
Copy link

@Crydust Crydust commented Jun 23, 2024

Purpose of changes

In the past I needed to change the signature of my unittest to be able to run it with HtmlUnit instead of with a slow browser. As HtmlUnitDriver implements WebDriver it seems logical to be able to use it as a pretend Selenium WebDriver when adding "-Dwdm.defaultBrowser=HTMLUNIT" to the command line.

// use -Dwdm.defaultBrowser=HTMLUNIT to run with htmlunit instead of a slow browser
@ExtendWith(SeleniumJupiter.class)
class HelloServletIT {
	@Test
	void shouldEchoName(WebDriver driver) {
		String expected = "example;
		String actual = HelloServletPage.go(driver).submitName(expected);
		assertThat(actual, is(expected));
	}
}

Types of changes

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

I've run the unittests and they pass except for the chrome ones, but that is because I'm on linux.
I've run "mvn install" on this project then used it on my selenium project by replacing the dependency like this:

		<dependency>
			<groupId>io.github.bonigarcia</groupId>
			<artifactId>selenium-jupiter</artifactId>
			<version>5.1.1-SNAPSHOT</version>
			<scope>test</scope>
		</dependency>

In the past I needed to change the signature of my unittest to be able to run it with HtmlUnit instead of with a slow browser.
As HtmlUnitDriver implements WebDriver it seems logical to be able to use it as a pretend Selenium WebDriver when adding "-Dwdm.defaultBrowser=HTMLUNIT" to the command line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant