When I try to run my Serenity test automation, I called following maven command:
mvn clean verify -Dentry_point="**/*SmokeTestSuite.java" -Dwebdriver.driver="iexplorer" -Dwebdriver.ie.driver="<my path>\IEDriverServer.exe"
I supplied the iexplorer as the driver and the path to the IEDriverServer.exe. My Internet Explorer version is 11.x. It errors out that I need to add the path to safari.exe when I am running the ie driver.
Follows is error stack trace :
[pool-1-thread-1] ERROR net.thucydides.core.webdriver.WebDriverFacade - FAILED TO CREATE NEW WEBDRIVER_DRIVER INSTANCE class org.openqa.selenium.ie.InternetExplorerDriver: Could not instantiate class org.openqa.selenium.ie.InternetExplorerDriver
net.thucydides.core.webdriver.UnsupportedDriverException: Could not instantiate class org.openqa.selenium.ie.InternetExplorerDriver
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:128)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:142)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:133)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:103)
at net.thucydides.core.webdriver.WebDriverFacade.getTitle(WebDriverFacade.java:213)
at net.serenitybdd.jbehave.SerenityReporter.managedDriverIsNotAlive(SerenityReporter.java:215)
at net.serenitybdd.jbehave.SerenityReporter.beforeScenario(SerenityReporter.java:188)
at org.jbehave.core.reporters.DelegatingStoryReporter.beforeScenario(DelegatingStoryReporter.java:55)
at org.jbehave.core.reporters.ConcurrentStoryReporter.beforeScenario(ConcurrentStoryReporter.java:158)
at org.jbehave.core.embedder.PerformableTree$PerformableScenario.perform(PerformableTree.java:877)
at org.jbehave.core.embedder.PerformableTree$PerformableStory.performScenarios(PerformableTree.java:811)
at org.jbehave.core.embedder.PerformableTree$PerformableStory.perform(PerformableTree.java:784)
at org.jbehave.core.embedder.PerformableTree.performCancellable(PerformableTree.java:416)
at org.jbehave.core.embedder.PerformableTree.perform(PerformableTree.java:387)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:291)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:265)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748) .
Caused by: java.lang.RuntimeException: Safari could not be found in the path!
Please add the directory containing ''Safari.exe'' to your PATH environment
variable, or explicitly specify a path to Safari like this:
*safari c:\blah\Safari.exe
at org.openqa.selenium.browserlaunchers.locators.SingleBrowserLocator.findBrowserLocationOrFail(SingleBrowserLocator.java:42)
at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:100)
at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:76)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:62)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:53)
at net.thucydides.core.webdriver.strategies.InternetExplorerDriverBuilder.newInstance(InternetExplorerDriverBuilder.java:30)
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:116)
... 19 more
webdriver.driver
is the correct Serenity property to set the driver. I'm not sure what DebajanB means by "error-prone" - as a rule, it works or it doesn't, and if it doesn't, it's a configuration issue. To check that the driver property is configured correctly in Maven (you may need to pass it into your tests as a system property in the surefire or failsafe plugin), see if it works with firefox.
The references to webdriver.gecko.driver etc tell Serenity where to find the binary for a particular driver, but they do not tell Serenity which driver to use. You can have several driver binaries configured, and then chose to use one or the other with webdriver.driver
.
Safari is not the default driver for Serenity, Firefox is, so the reference to Safari is curious. It may be a defect/misleading error message from an older version - are you using the latest version of Serenity?