How to configure IE Driver via System Properties in Environment Variables?

SeleniumAutomation TestingTesting Tools

We can configure IE Driver via System Properties in Environment variables. Firstly, we have to navigate to the link − https://www.selenium.dev/downloads/. Then click on the download link (32 or 64 it) based on the operating system available with us.

Once the download is done, a zip file gets created. It needs to be extracted and saved in a location. After the file is extracted, the executable file - IEDriverServer.exe becomes available.

Enter environment variables from the Start. Then click on Edit the system environment variables as shown on the below image.

Navigate to the Advanced tab in the System Properties pop-up. Then click on Environment Variables.

Once the Environment Variables pop-up opens, we shall move to the System variables and select the Path variable and click on Edit.

In the Edit environment variable box, select New.

Specify the path of the IE driver executable file which we have saved in a location previously.

Example

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import java.util.concurrent.TimeUnit;
public class IELaunch{
   public static void main(String[] args) {
      WebDriver driver = new InternetExplorerDriver();
      //implicit wait
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //URL launch
      driver.get("https://www.tutorialspoint.com/index.htm");
   }
}

Output

raja
Published on 06-Apr-2021 08:48:25
Advertisements