Configure Selenium WebDriver to use Internet Explorer

0 votes

As of 2015, the WebDriver specification became part of the W3C standard. The drivers are external, to make it more robust. We need to set the path to the driver executable in order to use the specific
driver. This section describes how to use Internet Explorer.

Download the latest iedriver from the following location:

public void useInternetExplorerDriver() {
  // Start browser
  System.setProperty("", FileUtil.findFileOnPath("IEDriverServer.exe"));
  final InternetExplorerDriver driver = new InternetExplorerDriver();
  // Open website
  // Close browser

Find file on path

public class FileUtil {

  public static String findFileOnPath(final String fileName) {
    if (new File(FileUtil.class.getClassLoader().getResource(fileName).getPath()).canExecute()) {
      return FileUtil.class.getClassLoader().getResource(fileName).getPath();
    } else {
      return new File("src/main/resources/" + fileName).getAbsolutePath();

Please follow and like us:
Configure Selenium WebDriver to use Chrome