Search code examples
javaseleniumselenium-webdriverselenium-iedriverselenium3

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.chrome.ChromeDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.openqa.selenium.ie.IEDriverService; //The import org.openqa.selenium.ie.IEDriverService cannot be resolved

public class Loginmethod {

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

    Thread.sleep(100);


}
}

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


Solution

  • 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.