Matt Brennan Matt Brennan - 9 months ago 127
Java Question

Selenium 3 InternetExplorerDriver Setup

I'm trying to set up a type of boiler-plate code for WebDriver that I can give to anyone in my QA team to help them test. My problem is that I can't seem to get Internet Explorer working. It's throwing errors and I have no idea how to fix them or if its some sort of naming issue.
The driver files are all in my C:\ Drive.

chromedriver.exe, geckodriver.exe, IEDriverServer.exe

Errors in the code below are //commented

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import; //The import cannot be resolved

public class Loginmethod {

public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver", "C:\\\\geckodriver.exe");
System.setProperty("", "C:\\\\chromedriver.exe");
System.setProperty("", "C:\\\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver(); //InternetExplorerDriver cannot be resolved to a type



Additionally, If anyone would know a way to test for Safari using windows 10 with selenium, that would be great.

Answer Source

The class you are trying to import is not the class you are using.

You are importing IEDriverService but using the InternetExplorerDriver class.

change your code to import InternetExplorerDriver.