Theo Paz
Theo Paz

Reputation: 11

Could not instantiate class org.openqa.selenium.edge.EdgeDriver in Serenity

Serenity is unable to find the msedgedriver executable from the serenity.properties file. My properties file looks like this:

#webdriver.driver=chrome
#webdriver.chrome.driver = src/test/resources/webdriver/windows/chromedriver-win64/chromedriver.exe

webdriver.driver=edge
webdriver.edge.driver = src/test/resources/webdriver/windows/edgedriver-win64/msedgedriver.exe

#webdriver.driver=firefox
#webdriver.geckodriver.driver = src/test/resources/webdriver/windows/firefoxdriver-win64/geckodriver.exe

...

When using chromedriver or geckodriver, Serenity has no issue finding their executables and instantiating the webdrivers as expected. The path to the msedgedriver is correct, and I've also tried absolute path with no luck.

My Edge Browser version is compatible with the downloaded msedgedriver version (123).

I cannot understand how Serenity is unable to successfully instantiate the driver, when I have correctly set the system property exactly like the other 2 drivers that work as expected.

Full error:

Caused by: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.edge.EdgeDriver (The path to the driver executable must be set by the webdriver.edge.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/MicrosoftWebDriver. The latest version can be downloaded from http://go.microsoft.com/fwlink/?LinkId=619687). See below for more details.

Upvotes: 1

Views: 426

Answers (1)

Theo Paz
Theo Paz

Reputation: 11

Found a workaround!

For some reason, setting the system property in the serenity.properties file or serenity.conf will not work for msedgedriver.

But if your project is a gradle build, you can set the system property in there and it will work:

test {
    systemProperty("webdriver.edge.driver", "src/test/resources/webdriver/windows/edgedriver-win64/msedgedriver.exe")
 }

Upvotes: 0

Related Questions