My Website

Main website: show.admoss.info

Thursday, September 12, 2024

Selenium 4 Magic

 I have been revisiting the Selenium package to automate testing web applications. Things have changed dramatically since I last used it several years ago.

I was at home using my MacBook Pro with an Intel processor and tried to find a suitable webdriver for Microsoft Edge. The nuget package looked ok but it would not install when I downloaded it. It complained it could not run chmod on one of its files. I wrestled with it for over an hour until I stumbled across the most amazing thing:

It seems Selenium now has a built-in driver manager. It operates like magic. If you instantiate a web driver without actually having installed it:

IWebDriver driver = new EdgeDriver();

this built in driver manager automatically determines the version of the browser you have installed, then locates, downloads, and installs the appropriate webdriver for you!

 This magic comes for free with Selenium 4 or newer.


No comments: