Using htmlunit webdriver

This commit is contained in:
Dirk Jahnke 2019-07-25 08:57:15 +02:00
parent ca010b7b25
commit 978d81bfdc
2 changed files with 18 additions and 5 deletions

View File

@ -3,7 +3,8 @@ package org.openqa.selenium.example;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver; //import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
@ -12,7 +13,9 @@ public class Selenium2Example {
// Create a new instance of the Firefox driver // Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface, // Notice that the remainder of the code relies on the interface,
// not the implementation. // not the implementation.
WebDriver driver = new FirefoxDriver(); //WebDriver driver = new FirefoxDriver();
//WebDriver driver = new RemoteWebDriver(new URL("http://jenkins.fredldev.fremo-net.eu:4444/wd/hub"), capability);
WebDriver driver = new HtmlUnitDriver(true);
// And now use this to visit Google // And now use this to visit Google
driver.get("http://www.google.com"); driver.get("http://www.google.com");

16
pom.xml
View File

@ -3,14 +3,24 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>MySel20Proj</groupId> <groupId>FreDLUiTests</groupId>
<artifactId>MySel20Proj</artifactId> <artifactId>FreDLUiTests</artifactId>
<version>1.0</version> <version>1.0</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId> <artifactId>selenium-server</artifactId>
<version>3.0.1</version> <version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.33.2</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>