Description
Hi so irrespective of me mentioning the browser version upon creating a HtmlDriver instance the driver is always defaulting to IE8
My Pom File
`
4.0.0
<groupId>basic-web-appJenkins</groupId>
<artifactId>jenkins</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jenkins</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-selenium-java3</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.4</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.4</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.20</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/libs-release-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
`
My Test Case
`@Test
public void testLoginCorrectCredentialsCorrect() throws Exception {
WebDriver webDriver = new HtmlUnitDriver(BrowserVersion.CHROME, true) {
@Override
protected WebClient modifyWebClient(WebClient client) {
final WebClient webClient = super.modifyWebClient(client);
// you might customize the client here
webClient.getOptions().setCssEnabled(false);
return webClient;
}
};
webDriver.get("https://reflectionsstaging.optisolbusiness.com");// step 2 web driver navigation
//ReflectionHome webElements = new ReflectionHome(webDriver);
if (webDriver.getTitle().equals("Reflection"))// step 3 locating an element
{
System.out.println(webDriver.getPageSource());
WebDriverWait wait = new WebDriverWait(webDriver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.name("email")));
webDriver.findElement(By.name("email")).sendKeys("yopmail.com"); // step 4,5 wait for return from the // browser
webDriver.findElement(By.name("password")).sendKeys("123");
// driver.findElement(By.linkText("Inventory Master")).click();
// driver.findElement(webElements.inventoryListItem).click();
} else {
fail("tes failed");
}
}`
My Imports:
import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.WebClient;
The output I get from page source where I verify that IE8 was called(obtained by using the getpagesource function)
If you notice in this output that I have shared IE8 is the browser that is being called. I opened IE Edge and emulated to see that my site does indeed throw the above error message in IE8 only. Would someone have a look at it and let me know how i can go about fixing this.