Table of Contents

Internet explorer driver server is the link between your tests and the IE browser. Without the server running on your system, you won't be able to communicate with the IE browser. So what exactly this server is ? and can we play with it a little bit?

Yup, we can, let's see how!!!

Basically IE driver server is a small application created by the awesome team which created Selenium WebDriver. As IE does not have a native implementation or API in java, they had no choice but to create a server. IE Driver server implements the WebDriver protocol. WebDriver protocol is a W3 standard that gives basic guidance on how a browser can expose itself for programmatic access. It also mandates a Language independent interface, so that the browser can be controlled externally via any programming language of choice. You can read about it more here.

Assuming that you will follow the link given above and read a bit, let me just jump into the details. In a nutshell, WebDriver implementation says that you can control a web browser by sending HTTP command requests. Each command can direct the browser to do something. This is exactly what IE driver server does, it starts a server and then waits for commands. These commands are issued by your tests in the form of various WebDriver dot actions. Like WebDriver.get, WebDriver.findElement etc.

Starting Internet explorer driver server from command line

To download the server you can go here. Just choose the latest version and download it based on whether you are on the 32 bit or a 64-bit operating system.

DownloadIEServer

Unzip the downloaded file to a known location on your computer. Simple go to the location where you unzipped the file using command prompt. As shown in the image below

CMDIeDriver

Simple type following command to understand what the arguments to the IE driver server

  • IeDriverServer.exe -help

You will get the list of all the available switches, as shown in the image below. Make a note of all the available options, we will use them to specify the different parameter.

CMDHelp

We can see that we have

  1. /port: to specify which port this server should run on
  2. /host: host ip to specify the host details
  3. /log-level: Based on the kind of debugging you want you can specify the Log level. Something similar to what you do in Log4j
  4. /log-file: specify the location of a log file where all the logs will be directed to.
  5. /implementation: I have no idea what it does? anybody?
  6. /extract-path: its the location where we can store the supporting file. I wasn't able to use it for any purpose though.
  7. /silent: if you want all the startup logs to not show up.

Let's start the server on port 1080, with a log file and log level of Debug. You can specify all this information in one command like this

IEDriverServer.exe /log-file=c:\users\abc\desktop\ielogs.txt /port=1080 /log-level=DEBUG

or

IEDriverServer.exe /port=1080 /log-level=DEBUG

the server will start at port 1080 and IP address of the server will be listed down in the logs which come up in the command prompt. As shown below

CMDServerStart

This is how you can start a server with a certain configuration on it.

Connecting to existing IE Driver server connection

Now let's connect to this server and launch IE. The code to do that is simple. All you have to do is specify which server you want to connect to in your test code. Here is a working sample, make sure that you replace the IP and other details at your end

	public static void main(String[] args) {

		String exePath = "C:\\Users\\abc\\Documents\\IEDriverServer\\IEDriverServer.exe";
		InternetExplorerDriverService.Builder serviceBuilder = new InternetExplorerDriverService.Builder();
		serviceBuilder.usingPort(1080); // This specifies that sever should start at this port
		serviceBuilder.usingDriverExecutable(new File(exePath)); //Tell it where you server exe is
		serviceBuilder.withHost("2.45.0.0");
		InternetExplorerDriverService service = serviceBuilder.build(); //Create a driver service and pass it to Internet explorer driver instance
		InternetExplorerDriver driver = new InternetExplorerDriver(service);
		driver.get("https://toolsqa.com");
	}

Run this code and see what's happening in the server window. You will see that logs will flow in. All these logs will be from the incoming connection of the code above. You will also see that the server will launch the browser and navigate it to toolsqa.com as specified by the command. If you have chosen a log file, you will get all the logs in the log file else all the logs will appear in the command prompt. Here is how your log file will look like

IELogsNotepad

And in the command prompt window same logs will appear, as show below

IELogsCMD

So basically this is how you can start a IE server, connect to it and then see some logs. Play around with the different options available to start IE driver server.

I hope you enjoyed this chapter.

Run Selenium tests on Edge
Run Selenium tests on Edge
Previous Article
Challenges to run Selenium Scripts with IE Browser
Challenges to run Selenium Scripts with IE Browser
Next Article
Virender Singh
I am Virender Singh, I have around 14 years of experience in the Technology domain.
Reviewers
Lakshay Sharma's Photo
Lakshay Sharma

Similar Articles

Feedback