Google+

Executing Selenium 2 Automation scripts on Internet Explorer 11 Browser

In order to execute the Selenium 2 Automation scripts on Internet Explorer 11 Browser , we need InternetExplorerDriver.



InternetExplorerDriver is not an inbuilt driver in Selenium:

Unlike FirefoxDriver, InternetExplorerDriver is not an inbuilt driver in Selenium. Instead we have to download the 'IEDriverServer.exe' file separately, apart from downloading Selenium Jar files.

Executing Selenium 2 Automation Scripts on Internet Explorer Driver

In order to execute the Selenium 2 Automation scripts, we need to configure the Java project using the Selenium 2.53.1 version Jar files. Selenium 2.53.1 version is the last version available in Selenium 2. For compatibility, we need to use the IEDriverServer.exe version of 2.53.1

Supported IE Browsers:

  • IE Browser versions -  7, 8, 9, 10 and 11

Executing Selenium 2 Automation scripts on IE 11:

Lets practically execute Selenium 2 Automation Scripts on Internet Explorer 11 Browser using the 2.53.1 version of IEDriverServer.exe:

1.Create a new Java Project in Eclipse IDE as shown below:



2. Create a 'libraries' folder in the project as shown below:



3. Go to http://www.seleniumhq.org/download/ and click on 'Previous Releases' option as shown below:



4. In the resultant page, click on '2.53' link option as shown below:



5. In the resultant page, click on 'Selenium-java-2.53.1.zip' link option as shown below:



6. Observe that a Zip file will be downloaded and extract the download Zip file as shown below:



7. Open the extracted folder and copy the two jar files as shown below:



8. Paste the copied Jar files into the 'libraries' folder in Java Project as shown below:



9.  Open the 'lib' folder inside the extracted folder as shown below:



10. Copy all the Jar files inside the 'libs' folder as shown below:



11. Paste all the Jar files into the 'libraries' folder in Java Project as shown below:



12. Now configure the Jar files in the 'libraries' folder. Right click on the Java Project and select 'Build Path > Configure Build Path' option as shown below:



13. In the resultant 'Properties' dialog, select 'libraries' tab and 'Add Jars' button as shown below:



14. In the resultant dialog, select all the Jar files under the 'libraries' folder and click on 'OK' and 'Apply' buttons until all the dialogs gets closed as shown below:



15. Observe that all the Selenium Jar files got configured and displayed as shown below:



16. Create a new Class in the Java Project as shown below:



17. Create a driver object for InternetExplorerDriver class as shown below:



18. Hover the mouse over the above error message and select the below displayed items to resolve the errors:



19. Observe that the errors got resolved and write the remaining Selenium code to navigate to http://www.omayo.blogspot.com, click on 'Selenium143' link on the page and close the browser as shown below



20. Open Internet Explorer browser in your windows machine and check its version as shown below:



21.  Execute the above Selenium code and observe that the code wont be executed on Internet Explorer 11 browser, instead we get an exception as shown below:



22. From the above error message, its clearly mentioned that we have to set the 'webdriver.ie.driver' property. We will write the below code to set the required property:



23. Copy the 'webdriver.ie.driver' from the error message and paste it as shown below:



24. Now, create a 'drivers' folder in the Java Project as shown below:



25. Go to http://www.seleniumhq.org/download/ and click on 'Previous Releases' option as shown below:


26. In the resultant page, click on '2.53' link option as shown below:


27. In the resultant page, click on 'IEDriverServer_Win32_2.53.1.zip' link option as shown below:



28. Extract the downloaded Zip file and open the extracted folder as shown below:



29. Copy the IEDriverServer.exe in the above opened folder as shown below:



30. Paste the copied exe file into the 'drivers' folder as shown below:



31. Now provide the path of the pasted 'IEDriverServer.exe' under the drivers folder in the Selenium code as shown below:



32. Now, we have the Java Project configured with Selenium 2.53.1 Jar files, the IE 11 browser and 2.53.1 version of  IEDriverServer.exe file along with its path set in the Selenium code. Lets execute the Selenium 2 Automation code as shown below:



33. On executing the above code, IE 11 browser will be launched, User will be navigated to http://www.omayo.blogspot.com application, 'Selenium143' link on the page will be clicked and hence the user will be navigated to http://www.selenium143.blogspot.com page and finally the browser will close.


Conclusion:

In order to execute the Selenium 2 automation scripts on IE 11 browser, we need to use the latest version of Selenium 2 i.e. Selenium 2.53.1, IE 11 Browser and 2.53.1 version of  IEDriverServer.exe along with IEDriverServer.exe's path set in the Selenium code. Here one main thing to observe is the version of Selenium 2 and the version of IEDriverServer.exe are same i.e. 2.53.1. This versions are chosen as same for compatibility purpose. 

No comments: