Google+

Selenium 3 and Edge Browser - Executing Selenium 3 Automation scripts on Microsoft Edge Browser

Before explaining on how to execute Selenium Automation scripts on Microsoft's Edge Browser, lets find out few details about Edge Browser:

Edge Browser

Edge Browser is provided by Microsoft and is available for us to use from Windows 10 Operating System. Microsoft Edge is the faster, safer browser designed for Windows 10. Click here to find more details on this browser. If you have Windows 10 machine, you can find the Edge Browser, which looks similar to Internet Explorer browser. In Windows 10 machine, you can find two browsers i.e. Internet Explorer Browser and Edge Browser. Hope you find out more details on Edge Browser over web.

Selenium 3 and Edge Browser

In order to execute the Selenium 3 Automation scripts on Microsoft Edge Browser , we need EdgeDriver.

EdgeDriver is provided by Microsoft:

Unlike FirefoxDriver, EdgeDriver is not an inbuilt driver in Selenium. Instead it owned, supported & developed by Microsoft for Selenium and hence have to download it from Microsoft website.



Selenium 3 and Edge Driver

In order to execute the Selenium 3 Automation scripts on Edge Browser, we need to configure the Java project using the latest version Jar files of Selenium 3 .  For compatibility, we need to download the latest version of  Edge Driver from Microsoft website.

Executing Selenium 3 Automation Scripts on Edge Browser

Lets practically execute Selenium 3 Automation Scripts on Edge Browser using the latest versions of Selenium 3 and Edge Driver:

1.In Windows 10 machine, 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/  as shown below:



4. Click on 'Download' option of latest Java version of Selenium 3 as shown below:



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



6. Open the extracted folder as shown below:



7. Copy the jar file inside inside the extracted folder:



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 Edge Driver 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.  Execute the above Selenium code as shown below:





21. Observe that the code wont be executed on Edge 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.edge.driver' property. We will write the below code to set the required property:



23. Copy the 'webdriver.edge.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/ as shown below:



26. Click on 'Microsoft Edge Driver' option as shown below to download the latest edge driver:



27. On clicking the 'Microsoft Edge Driver' option from the above page, you will be taken to the Microsoft's Website page as shown below:



28. Click to download the latest version of Edge Driver as shown below:



29. The latest version of Edge Driver .exe will be downloaded as shown below:



30. Extract and open the downloaded zip file and copy the .exe file of Edge Driver in the extracted folder as shown below:



31. Paste the copied .exe file of Edge Driver into the 'drivers' folder as shown below:



32. Right click on the copied edge driver .exe file and select 'Properties' option as shown below:



33. In the resultant 'Properties' dialog, copy the selected path as shown below:



34. Paste the copied path into the selenium code as shown below:



35.  Now, we have the Java Project configured with the latest version of Selenium 3 Jar files and the latest version of Edge Driver's .exe file along with its path set in the Selenium code. Lets execute the Selenium 3 Automation code as shown below:



36. On executing the above code, Edge browser in Windows 10 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 3 automation scripts on Edge browser, we need to use the latest version of Selenium 3 and the latest version of Edge Driver's .exe file and then set the Edge Driver's .exe file path set in the Selenium code.

No comments: