serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
724 stars 518 forks source link

java.lang.IllegalStateException: The driver executable does not exist [not dup] #1647

Closed drkstr101 closed 2 years ago

drkstr101 commented 5 years ago

Hello,

java.lang.IllegalStateException: The driver executable does not exist: C:\Users\aarmiller\Workspace\hiflex\hiflex-compass-decom\spec\src\test\resources\webdriver\windows\chromedriver.exe

But...

C:\Users\aarmiller\Workspace\hiflex\hiflex-compass-decom\spec\src\test\resources\webdriver\windows\chromedriver.exe

Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 9515 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

Serenity seems to think provided chromedriver in serenity-cucumber-starter project is missing when it is there and executable from the provided absolute path in he debug message. Is this possibly related to Windows path issue #1644?

Cheers and thank you!

The specified driver value of 'spec\src\test\resources\webdriver\windows\chromedriver.exe' appears to be incorrect. Make sure it is the correct WebDriver driver for this operating system.
    When she navigates to the "PRODUCTION" Home page # StackstormSteps.she_navigates_to_the_Home_page(String)
      net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver
    at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:144)
    at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:132)
    at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:102)
    at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:172)
    at net.serenitybdd.core.pages.PageObject.openPageAtUrl(PageObject.java:864)
    at net.serenitybdd.core.pages.PageObject.open(PageObject.java:725)
    at net.serenitybdd.core.pages.PageObject.open(PageObject.java:710)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:167)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
    at hiflex.compass.decom.steps.AdminSteps.openAdminPanelFor(AdminSteps.groovy:45)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3.CGLIB$openAdminPanelFor$14(<generated>)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3$$FastClassByCGLIB$$3b4dc58c.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:478)
    at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:463)
    at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:438)
    at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:179)
    at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:166)
    at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:72)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3.openAdminPanelFor(<generated>)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3$openAdminPanelFor$1.call(Unknown Source)
    at hiflex.compass.decom.steps.StackstormSteps.she_navigates_to_the_Home_page(StackstormSteps.groovy:35)
    at ?.she navigates to the "PRODUCTION" Home page(features/st2/st2_environments.feature:9)
Caused by: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (The driver executable does not exist: C:\Users\aarmiller\Workspace\hiflex\hiflex-compass-decom\spec\src\test\resources\webdriver\windows\chromedriver.exe). See below for more details.
    at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:137)
    at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:141)
    at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:132)
    at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:102)
    at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:172)
    at net.serenitybdd.core.pages.PageObject.openPageAtUrl(PageObject.java:864)
    at net.serenitybdd.core.pages.PageObject.open(PageObject.java:725)
    at net.serenitybdd.core.pages.PageObject.open(PageObject.java:710)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:167)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
    at hiflex.compass.decom.steps.AdminSteps.openAdminPanelFor(AdminSteps.groovy:45)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3.CGLIB$openAdminPanelFor$14(<generated>)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3$$FastClassByCGLIB$$3b4dc58c.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:478)
    at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:463)
    at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:438)
    at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:179)
    at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:166)
    at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:72)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3.openAdminPanelFor(<generated>)
    at hiflex.compass.decom.steps.AdminSteps$$EnhancerByCGLIB$$d1757ae3$openAdminPanelFor$1.call(Unknown Source)
    at hiflex.compass.decom.steps.StackstormSteps.she_navigates_to_the_Home_page(StackstormSteps.groovy:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at cucumber.runtime.Utils$1.call(Utils.java:31)
    at cucumber.runtime.Timeout.timeout(Timeout.java:16)
    at cucumber.runtime.Utils.invoke(Utils.java:25)
    at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:37)
    at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:40)
    at cucumber.api.TestStep.executeStep(TestStep.java:102)
    at cucumber.api.TestStep.run(TestStep.java:83)
    at cucumber.api.TestCase.run(TestCase.java:58)
    at cucumber.runner.Runner.runPickle(Runner.java:80)
    at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:118)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:56)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:127)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
    at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
    at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: The driver executable does not exist: C:\Users\aarmiller\Workspace\hiflex\hiflex-compass-decom\spec\src\test\resources\webdriver\windows\chromedriver.exe
    at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
    at net.serenitybdd.core.webdriver.servicepools.DriverServiceExecutable.checkExecutable(DriverServiceExecutable.java:169)
    at net.serenitybdd.core.webdriver.servicepools.DriverServiceExecutable.checkForMissingBinaries(DriverServiceExecutable.java:158)
    at net.serenitybdd.core.webdriver.servicepools.DriverServiceExecutable.asAFile(DriverServiceExecutable.java:117)
    at net.serenitybdd.core.webdriver.servicepools.ChromeServicePool.chromeDriverExecutable(ChromeServicePool.java:44)
    at net.serenitybdd.core.webdriver.servicepools.ChromeServicePool.newDriverService(ChromeServicePool.java:25)
    at net.serenitybdd.core.webdriver.servicepools.ChromeServicePool.newDriverService(ChromeServicePool.java:12)
    at net.serenitybdd.core.webdriver.servicepools.DriverServicePool.driverServiceWithName(DriverServicePool.java:54)
    at net.serenitybdd.core.webdriver.servicepools.DriverServicePool.getDriverService(DriverServicePool.java:45)
    at net.serenitybdd.core.webdriver.servicepools.DriverServicePool.start(DriverServicePool.java:60)
    at net.serenitybdd.core.webdriver.servicepools.DriverServicePool.ensureServiceIsRunning(DriverServicePool.java:86)
    at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverProvider.getDriverServicePool(ChromeDriverProvider.java:29)
    at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverProvider.newInstance(ChromeDriverProvider.java:49)
    at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:127)
    ... 90 more
wakaleo commented 5 years ago

Can you put a breakpoint in DriverServiceExecutable (in the checkExecutable() method) to see what path it is trying to use?

drkstr101 commented 5 years ago

The value in debugger is same as the relative path set in serenity.conf, but does not include the absolute base path, as shown in the error message.

net.thucydides.core.webdriver.UnsupportedDriverException: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (Unable to find executable for: C:\Users\aarmiller\Workspace\aarmiller\serenity-examples\src\test\resources\webdriver\window\chromedriver.exe at net.thucydides.showcase.junit.steps.serenity.BuyerSteps.opens_home_page(BuyerSteps.java:24) at net.thucydides.showcase.junit.features.cart.AddItemsToCartTest.add_item_to_cart(AddItemsToCartTest.java:25)

After running a few more tests, I've realized the issue is actually with Gradle (possibly others?) multi-project builds, where the serenity project is not also the root project.

https://scans.gradle.com/s/kyc2rzaebyati/ [good] https://scans.gradle.com/s/qnep3uitzd6bs/ [bad]

The failed build was kicked off from the gradle wrapper in root project, while the good one was run directly from the sub-project directory.

I have noticed some other strange behavior when running Gradle builds from a parent wrapper, but this is the only thing I can consistently reproduce. You may want to consider this case during your normal course of release tests.

Cheers!

I posted my example project if you are interested:

https://gitlab.com/drkstr101/serenity-examples

drkstr101 commented 5 years ago

Sorry to double post, but I realize I was not very clear on what the actual issue is.

There appears to be no way (that I know of) to reference the webdriver binaries using a relative path, provided the project under test is not the top level project (in Gradle at least). However, using the relative path from rootDir yields the correct path to the executable in the INFO log output. Regardless, it will report the file as missing unless absolute path is set in serenity.conf.