0

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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

0

This error message...

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

...implies that the program was unable to create/spawn a desired new InternetExplorerDriver instance.

The main reason of this error is the error prone maven command you have used to execute the Serenity Test Automation Suite which is as follows :

mvn clean verify -Dentry_point="**/*SmokeTestSuite.java" -Dwebdriver.driver="iexplorer" -Dwebdriver.ie.driver="<my path>\IEDriverServer.exe"

The most commonly used WebDriver variants are :

  • -Dwebdriver.gecko.driver - For geckodriver.exe
  • -Dwebdriver.chrome.driver - For chromedriver.exe
  • -Dwebdriver.ie.driver - For IEDriverServer.exe

But as you have used an incorrect argument as -Dwebdriver.driver along with an incorrect value as iexplorer the Serenity Test Automation Framework tries to access the default configuration of Safari.exe.

Solution

You need to remove the error prone argument -Dwebdriver.driver="iexplorer" and you will be through.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

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?

John Smart
  • 969
  • 1
  • 5
  • 5
  • I set iexplorer in failsafe plugin but it's gaves same error. Right now I am using serenity version 1.1.39, it is a fairly old version, might the cause of the misleading error as you suggested. – user3053729 May 15 '18 at 15:28
  • updating serenity to 1.2.2 did resolve the above issue. But now internet explorer keeps messaging out "This is the initial start page for the WebDriver server" – user3053729 May 15 '18 at 17:58