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
722 stars 518 forks source link

net.thucydides.core.pages.WrongPageError: The page object class .Homepage looks dodgy: #1668

Closed mahesht36 closed 5 years ago

mahesht36 commented 5 years ago

Testing started at 17:23 ... 17:23:50: Executing tasks ':cleanTest :test --tests "com.Nothing.weeklyCashBalancing.runners.CucumberTest"'...

:cleanTest UP-TO-DATE :compileJava NO-SOURCE :processResources NO-SOURCE :classes UP-TO-DATE :compileTestJava :processTestResources UP-TO-DATE :testClasses :test SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Feature: Login into Weekly Cash Balancing Application

Scenario Outline: To verify that user is able to login into weekly cash balancing application # src/test/resources/features/LoginWCB.feature:5 Given User opens the WCB Application url to login Then verify the title of page is "" When User login to WCB Application using valid userName "<username>" and password "<password>" and click logon button Then verify the title of page is "<title of page>" Then User able to "<select branch>" Then verify the title of page is "<title of page>"</p> <pre><code>Examples: </code></pre> <p>Scenario Outline: To verify that user is able to login into weekly cash balancing application # src/test/resources/features/LoginWCB.feature:14 Given User opens the WCB Application url to login # WCBStepDefination.userOpenURL() net.thucydides.core.pages.WrongPageError: The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293) at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:223) at net.thucydides.core.pages.Pages.getPage(Pages.java:90) at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55) at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33) at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139) at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86) at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16) at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:75) at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:59) at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:41) at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:135) at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:101) at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:68) at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:51) at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:41) 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:117) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55) 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:126) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) 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.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) 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:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) 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) at ?.User opens the WCB Application url to login(src/test/resources/features/LoginWCB.feature:6)</p> <pre><code>Then verify the title of page is "<title of page>" # WCBStepDefination.verifyTitalOfPage(String) When User login to WCB Application using valid userName "TPU201" and password "cogni1" and click logon button # WCBStepDefination.userLoginToWCBApplicationUsingValidAnd(String,String) Then verify the title of page is "<title of page>" # WCBStepDefination.verifyTitalOfPage(String) Then User able to "Oxford Street" # WCBStepDefination.userAbleToSelectBrach(String) Then verify the title of page is "<title of page>" # WCBStepDefination.verifyTitalOfPage(String)</code></pre> <p>The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) net.thucydides.core.pages.WrongPageError: The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293) at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:223) at net.thucydides.core.pages.Pages.getPage(Pages.java:90) at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55) at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33) at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139) at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86) at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16) at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:75) at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:59) at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:41) at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:135) at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:101) at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:68) at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:51) at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:41) 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:117) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55) 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:126) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) 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.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) 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:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) 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) at ✽.User opens the WCB Application url to login(src/test/resources/features/LoginWCB.feature:6)</p> <p>com.Nothing.weeklyCashBalancing.runners.CucumberTest > Login into Weekly Cash Balancing Application.To verify that user is able to login into weekly cash balancing application FAILED net.thucydides.core.pages.WrongPageError</p> <pre><code>Examples: </code></pre> <p>Scenario Outline: To verify that user is able to login into weekly cash balancing application # src/test/resources/features/LoginWCB.feature:17 Given User opens the WCB Application url to login # WCBStepDefination.userOpenURL() net.thucydides.core.pages.WrongPageError: The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293) at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:223) at net.thucydides.core.pages.Pages.getPage(Pages.java:90) at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55) at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33) at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139) at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86) at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16) at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:75) at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:59) at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:41) at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:135) at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:101) at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:68) at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:51) at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:41) 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:117) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55) 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:126) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) 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.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) 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:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) 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) at ?.User opens the WCB Application url to login(src/test/resources/features/LoginWCB.feature:6)</p> <pre><code>Then verify the title of page is "Log on to Weekly Cash Balancing" # WCBStepDefination.verifyTitalOfPage(String) When User login to WCB Application using valid userName "<username>" and password "<password>" and click logon button # WCBStepDefination.userLoginToWCBApplicationUsingValidAnd(String,String) Then verify the title of page is "Log on to Weekly Cash Balancing" # WCBStepDefination.verifyTitalOfPage(String) Then User able to "<select branch>" # WCBStepDefination.userAbleToSelectBrach(String) Then verify the title of page is "Log on to Weekly Cash Balancing" # WCBStepDefination.verifyTitalOfPage(String)</code></pre> <p>The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) net.thucydides.core.pages.WrongPageError: The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293) at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:223) at net.thucydides.core.pages.Pages.getPage(Pages.java:90) at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55) at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33) at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139) at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86) at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16) at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:75) at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:59) at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:41) at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:135) at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:101) at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:68) at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:51) at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:41) 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:117) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55) 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:126) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) 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.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) 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:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) 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) at ✽.User opens the WCB Application url to login(src/test/resources/features/LoginWCB.feature:6)</p> <p>com.Nothing.weeklyCashBalancing.runners.CucumberTest > Login into Weekly Cash Balancing Application.To verify that user is able to login into weekly cash balancing application FAILED net.thucydides.core.pages.WrongPageError</p> <p>Failed scenarios: src/test/resources/features/LoginWCB.feature:14 # To verify that user is able to login into weekly cash balancing application src/test/resources/features/LoginWCB.feature:17 # To verify that user is able to login into weekly cash balancing application</p> <p>2 Scenarios (2 failed) 12 Steps (2 failed, 10 skipped) 0m6.471s</p> <p>net.thucydides.core.pages.WrongPageError: The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293) at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:223) at net.thucydides.core.pages.Pages.getPage(Pages.java:90) at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55) at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33) at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139) at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86) at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16) at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:75) at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:59) at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:41) at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:135) at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:101) at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:68) at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:51) at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:41) 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:117) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55) 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:126) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) 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.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) 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:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) 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) at ?.User opens the WCB Application url to login(src/test/resources/features/LoginWCB.feature:6)</p> <p>net.thucydides.core.pages.WrongPageError: The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy: Failed to instantiate page (java.lang.RuntimeException: Could not instantiate the custom webdriver provider of type driverutil.DriverUtil) at net.thucydides.core.pages.Pages.thisPageObjectLooksDodgy(Pages.java:293) at net.thucydides.core.pages.Pages.getCurrentPageOfType(Pages.java:223) at net.thucydides.core.pages.Pages.getPage(Pages.java:90) at net.thucydides.core.steps.PageObjectDependencyInjector.instantiatePageObjectIfNotAssigned(PageObjectDependencyInjector.java:55) at net.thucydides.core.steps.PageObjectDependencyInjector.injectDependenciesInto(PageObjectDependencyInjector.java:33) at net.thucydides.core.steps.StepFactory.injectOtherDependenciesInto(StepFactory.java:166) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:156) at net.thucydides.core.steps.StepFactory.instantiateNewStepLibraryFor(StepFactory.java:139) at net.thucydides.core.steps.StepFactory.getNewStepLibraryFor(StepFactory.java:86) at net.thucydides.core.steps.IndividualInstancesByDefaultStepCreationStrategy.initiateStepsFor(IndividualInstancesByDefaultStepCreationStrategy.java:16) at net.thucydides.core.steps.StepAnnotations.instantiateAnyUnitiaializedSteps(StepAnnotations.java:75) at net.thucydides.core.steps.StepAnnotations.instanciateScenarioStepFields(StepAnnotations.java:59) at net.thucydides.core.steps.StepAnnotations.injectScenarioStepsInto(StepAnnotations.java:41) at net.serenitybdd.core.Serenity.injectScenarioStepsInto(Serenity.java:135) at net.serenitybdd.core.Serenity.initializeWithNoStepListener(Serenity.java:101) at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:68) at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:51) at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:41) 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:117) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55) 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:126) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66) 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.$Proxy1.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:108) 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:146) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128) 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) at ?.User opens the WCB Application url to login(src/test/resources/features/LoginWCB.feature:6)</p> <p>2 tests completed, 2 failed :test FAILED FAILURE: Build failed with an exception.</p> <ul> <li>What went wrong: Execution failed for task ':test'. <blockquote> <p>There were failing tests. See the report at: file:///C:/Automation/comms-regression-master/weeklycashbalance/build/reports/tests/test/index.html</p> </blockquote></li> <li>Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.</li> <li>Get more help at <a href="https://help.gradle.org">https://help.gradle.org</a> BUILD FAILED in 19s 4 actionable tasks: 2 executed, 2 up-to-date There were failing tests. See the report at: file:///C:/Automation/comms-regression-master/weeklycashbalance/build/reports/tests/test/index.html</li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <h1>this is the error i am getting this is my build.gradle</h1> <p>defaultTasks 'clean', 'test', 'serenity:aggregate'</p> <p>repositories { mavenCentral() jcenter() }</p> <p>buildscript { repositories { mavenLocal() jcenter() } dependencies { classpath("net.serenity-bdd:serenity-gradle-plugin:1.9.12") } }</p> <p>apply plugin: 'idea' apply plugin: 'java' apply plugin: 'net.serenity-bdd.aggregator'</p> <p>sourceCompatibility = 1.8</p> <p>dependencies {</p> <pre><code>compile group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: '1.9.25' compile group: 'net.serenity-bdd', name: 'serenity-core', version: '1.9.12' compile group: 'net.serenity-bdd', name: 'serenity-cucumber', version: '1.9.5' compile group: 'net.serenity-bdd', name: 'serenity-junit', version: '1.9.12' compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9' compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.2.0' compile group: 'javax', name: 'javaee-api', version: '7.0' compile group: 'org.simplejavamail', name: 'simple-java-mail', version: '4.1.2' compile group: 'com.google.code.gson', name: 'gson', version: '2.7' compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1' compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '3.4.0' compile group: 'javax.mail', name: 'javax.mail-api', version: '1.6.0' compile 'com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8' compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3' test { testLogging.showStandardStreams = true systemProperties System.getProperties() }</code></pre> <p>} gradle.startParameter.continueOnFailure = true</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p><code>WrongPageError</code> means Serenity was unable to instantiate your page object; possibly because the constructor is not as expected, or that some exception is thrown during the creation process.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>Hi , I am not getting you point,very new to this gradle and cucumber. If you have time can we connect over Skype. Mahesht88</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>If you post your Page Object class there might be something easy to spot. Otherwise you can ask the Serenity community on <a href="https://serenity-bdd.rocket.chat">https://serenity-bdd.rocket.chat</a>, or if your question is urgent, you can find some commercial support options here: <a href="https://johnfergusonsmart.com/serenity-bdd-mentoring/">https://johnfergusonsmart.com/serenity-bdd-mentoring/</a></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>package net.thucydides.core.pages;</p> <p>import com.google.common.base.Predicate; import org.openqa.selenium.WebDriver;</p> <p>public abstract class PageObject extends net.serenitybdd.core.pages.PageObject {</p> <pre><code>protected PageObject() { super(); } protected PageObject(WebDriver driver, Predicate<? super net.serenitybdd.core.pages.PageObject> callback) { super(driver, callback); } public PageObject(WebDriver driver, int ajaxTimeout) { super(driver, ajaxTimeout); } public PageObject(WebDriver driver) { super(driver); }</code></pre> <p>}</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>package net.serenitybdd.core.pages;</p> <p>import com.google.common.base.Predicate; import com.paulhammant.ngwebdriver.NgWebDriver; import net.serenitybdd.core.collect.NewList; import net.thucydides.core.ThucydidesSystemProperty; import net.thucydides.core.annotations.WhenPageOpens; import net.thucydides.core.fluent.ThucydidesFluentAdapter; import net.thucydides.core.guice.Injectors; import net.thucydides.core.pages.Pages; import net.thucydides.core.pages.WrongPageError; import net.thucydides.core.pages.components.Dropdown; import net.thucydides.core.pages.components.FileToUpload; import net.thucydides.core.pages.jquery.JQueryEnabledPage; import net.thucydides.core.reflection.MethodFinder; import net.thucydides.core.scheduling.FluentWaitWithRefresh; import net.thucydides.core.scheduling.NormalFluentWait; import net.thucydides.core.scheduling.ThucydidesFluentWait; import net.thucydides.core.steps.PageObjectStepDelayer; import net.thucydides.core.steps.StepEventBus; import net.thucydides.core.steps.WaitForBuilder; import net.thucydides.core.util.EnvironmentVariables; import net.thucydides.core.util.Inflector; import net.thucydides.core.webdriver.<em>; import net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade; import net.thucydides.core.webelements.Checkbox; import net.thucydides.core.webelements.RadioButtonGroup; import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.</em>; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory;</p> <p>import java.time.Duration;</p> <p>import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.time.temporal.TemporalUnit; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit;</p> <p>import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MINUTES; import static net.serenitybdd.core.selectors.Selectors.xpathOrCssSelector; import static net.thucydides.core.ThucydidesSystemProperty.THUCYDIDES_JQUERY_INTEGRATION; import static net.thucydides.core.ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_FLUENTWAIT; import static net.thucydides.core.ThucydidesSystemProperty.WEBDRIVER_WAIT_FOR_TIMEOUT; import static net.thucydides.core.webdriver.javascript.JavascriptSupport.javascriptIsSupportedIn;</p> <p>/**</p> <ul> <li>A base class representing a WebDriver page object.</li> <li> </li> <li> <p>@author johnsmart */ public abstract class PageObject {</p> <p>private static final int WAIT_FOR_ELEMENT_PAUSE_LENGTH = 250;</p> <p>private static final Logger LOGGER = LoggerFactory.getLogger(PageObject.class);</p> <p>private WebDriver driver;</p> <p>private Pages pages;</p> <p>private MatchingPageExpressions matchingPageExpressions;</p> <p>private RenderedPageObjectView renderedView;</p> <p>private PageUrls pageUrls;</p> <p>private net.serenitybdd.core.time.SystemClock clock;</p> <p>private Duration waitForTimeout; private Duration waitForElementTimeout;</p> <p>private final Sleeper sleeper; private final Clock webdriverClock; private JavascriptExecutorFacade javascriptExecutorFacade;</p> <p>private EnvironmentVariables environmentVariables;</p> <p>public void setImplicitTimeout(int duration, TemporalUnit unit) {</p> <pre><code>waitForElementTimeout = Duration.of(duration, unit); setDriverImplicitTimeout(waitForElementTimeout);</code></pre> <p>}</p> <p>private void setDriverImplicitTimeout(Duration implicitTimeout) { if (driver instanceof ConfigurableTimeouts) { ((ConfigurableTimeouts) driver).setImplicitTimeout(implicitTimeout); } else { driver.manage().timeouts().implicitlyWait(implicitTimeout.toMillis(), MILLISECONDS); } }</p> <p>public void resetImplicitTimeout() { if (driver instanceof ConfigurableTimeouts) { waitForElementTimeout = ((ConfigurableTimeouts) driver).resetTimeouts(); } else { waitForElementTimeout = getDefaultImplicitTimeout(); driver.manage().timeouts().implicitlyWait(waitForElementTimeout.toMillis(), MILLISECONDS); } }</p> <p>private Duration getDefaultImplicitTimeout() { Integer configuredTimeout = ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT.integerFrom(environmentVariables); return Duration.ofMillis(configuredTimeout); }</p> <p>private enum OpenMode { CHECK_URL_PATTERNS, IGNORE_URL_PATTERNS }</p> <p>protected PageObject() { this.webdriverClock = new SystemClock(); this.clock = Injectors.getInjector().getInstance(net.serenitybdd.core.time.SystemClock.class); this.environmentVariables = Injectors.getInjector().getProvider(EnvironmentVariables.class).get(); this.sleeper = Sleeper.SYSTEM_SLEEPER; setupPageUrls(); }</p> <p>protected PageObject(final WebDriver driver, Predicate<? super PageObject> callback) { this(); this.driver = driver; callback.apply(this); }</p> <p>public PageObject(final WebDriver driver, final int ajaxTimeout) { this(); setDriver(driver, ajaxTimeout); }</p> <p>public PageObject(final WebDriver driver) { this(); ThucydidesWebDriverSupport.useDriver(driver); setDriver(driver); }</p> <p>public PageObject(final WebDriver driver, final EnvironmentVariables environmentVariables) { this(); this.environmentVariables = environmentVariables; setDriver(driver); }</p> <p>protected void setDriver(WebDriver driver, long timeout) { this.driver = driver; new DefaultPageObjectInitialiser(driver, timeout).apply(this); }</p> <p>public <T extends PageObject> T setDriver(WebDriver driver) { setDriver(driver, getImplicitWaitTimeout().toMillis()); return (T) this; }</p> <p>public <T extends PageObject> T withDriver(WebDriver driver) { return setDriver(driver); }</p> <p>public Duration getWaitForTimeout() {</p> <pre><code>if (waitForTimeout == null) { int configuredWaitForTimeoutInMilliseconds =fluentWaitTimeout(); waitForTimeout = Duration.ofMillis(configuredWaitForTimeoutInMilliseconds); } return waitForTimeout;</code></pre> <p>}</p> <p>private int fluentWaitTimeout() { return (WEBDRIVER_WAIT_FOR_TIMEOUT.integerFrom(environmentVariables, WEBDRIVER_TIMEOUTS_FLUENTWAIT.integerFrom(environmentVariables, (int) DefaultTimeouts.DEFAULT_WAIT_FOR_TIMEOUT.toMillis()))); }</p> <p>@Deprecated public Duration getWaitForElementTimeout() { return getImplicitWaitTimeout(); }</p> <p>public Duration getImplicitWaitTimeout() {</p> <pre><code>if (waitForElementTimeout == null) { int configuredWaitForTimeoutInMilliseconds = ThucydidesSystemProperty.WEBDRIVER_TIMEOUTS_IMPLICITLYWAIT .integerFrom(environmentVariables, (int) DefaultTimeouts.DEFAULT_IMPLICIT_WAIT_TIMEOUT.toMillis()); waitForElementTimeout = Duration.ofMillis(configuredWaitForTimeoutInMilliseconds); } return waitForElementTimeout;</code></pre> <p>}</p> <p>public void setPages(Pages pages) { this.pages = pages; }</p> <p>public <T extends PageObject> T switchToPage(final Class<T> pageObjectClass) { if (pages.getDriver() == null) { pages.setDriver(driver); }</p> <pre><code>return pages.getPage(pageObjectClass);</code></pre> <p>}</p> <p>/**</p> <ul> <li>Upload a file via an HTML form.</li> <li>By default, this will look for a file on the file system, at the location provided. */ public FileToUpload upload(final String filename) { return new FileToUpload(driver, filename).useRemoteDriver(isDefinedRemoteUrl()); }</li> </ul> <p>public FileToUpload uploadData(String data) throws IOException { Path datafile = Files.createTempFile("upload", "data"); Files.write(datafile, data.getBytes(StandardCharsets.UTF_8)); return new FileToUpload(driver, datafile.toAbsolutePath().toString()).useRemoteDriver(isDefinedRemoteUrl()); }</p> <p>public FileToUpload uploadData(byte[] data) throws IOException { Path datafile = Files.createTempFile("upload", "data"); Files.write(datafile, data); return new FileToUpload(driver, datafile.toAbsolutePath().toString()).useRemoteDriver(isDefinedRemoteUrl()); }</p> <p>private boolean isDefinedRemoteUrl() { boolean isRemoteUrl = ThucydidesSystemProperty.WEBDRIVER_REMOTE_URL.isDefinedIn(environmentVariables); boolean isSaucelabsUrl = ThucydidesSystemProperty.SAUCELABS_URL.isDefinedIn(environmentVariables); boolean isBrowserStack = ThucydidesSystemProperty.BROWSERSTACK_URL.isDefinedIn(environmentVariables); return isRemoteUrl || isSaucelabsUrl || isBrowserStack; }</p> <p>private void setupPageUrls() { setPageUrls(new PageUrls(this)); }</p> <p>/**</p> <ul> <li>Only for testing purposes. */ public void setPageUrls(PageUrls pageUrls) { this.pageUrls = pageUrls; }</li> </ul> <p>public void setWaitForTimeout(final long waitForTimeoutInMilliseconds) { this.waitForTimeout = Duration.ofMillis(waitForTimeoutInMilliseconds); getRenderedView().setWaitForTimeout(this.waitForTimeout); }</p> <p>public void setWaitForElementTimeout(final long waitForTimeoutInMilliseconds) { this.waitForElementTimeout = Duration.ofMillis(waitForTimeoutInMilliseconds); }</p> <p>protected RenderedPageObjectView getRenderedView() { if (renderedView == null) { renderedView = new RenderedPageObjectView(driver, this, getWaitForTimeout(), true); } return renderedView; }</p> <p>protected net.serenitybdd.core.time.SystemClock getClock() { return clock; }</p> <p>private MatchingPageExpressions getMatchingPageExpressions() { if (matchingPageExpressions == null) { matchingPageExpressions = new MatchingPageExpressions(this); } return matchingPageExpressions; }</p> <p>public WebDriver getDriver() { return driver; }</p> <p>public String getTitle() { return driver.getTitle(); }</p> <p>public boolean matchesAnyUrl() { return thereAreNoPatternsDefined(); }</p> <p>/**</p> <ul> <li>Does this page object work for this URL? When matching a URL, we check</li> <li>with and without trailing slashes */ public final boolean compatibleWithUrl(final String currentUrl) { return thereAreNoPatternsDefined() || matchUrlAgainstEachPattern(currentUrl); }</li> </ul> <p>private boolean matchUrlAgainstEachPattern(final String currentUrl) { return getMatchingPageExpressions().matchUrlAgainstEachPattern(currentUrl); }</p> <p>private boolean thereAreNoPatternsDefined() { return getMatchingPageExpressions().isEmpty(); }</p> <p>public PageObject waitForRenderedElements(final By byElementCriteria) { getRenderedView().waitFor(byElementCriteria); return this; }</p> <p>/**</p> <ul> <li>@Deprecated TimeUnit has been replaced by TemporalUnit in Selenium. For more consistancy use a TemporalUnit parameter. */ @Deprecated public RenderedPageObjectView withTimeoutOf(int timeout, TimeUnit units) { return withTimeoutOf(Duration.of(timeout, TemporalUnitConverter.fromTimeUnit(units))); }</li> </ul> <p>public RenderedPageObjectView withTimeoutOf(int timeout, TemporalUnit units) { return withTimeoutOf(Duration.of(timeout, units)); }</p> <p>public RenderedPageObjectView withTimeoutOf(Duration timeout) { return new RenderedPageObjectView(driver, this, timeout, false); }</p> <p>public PageObject waitFor(String xpathOrCssSelector) { return waitForRenderedElements(xpathOrCssSelector(xpathOrCssSelector)); }</p> <p>public PageObject waitFor(ExpectedCondition expectedCondition) { getRenderedView().waitFor(expectedCondition); return this; }</p> <p>public PageObject waitForRenderedElementsToBePresent(final By byElementCriteria) { getRenderedView().waitForPresenceOf(byElementCriteria);</p> <pre><code>return this;</code></pre> <p>}</p> <p>public PageObject waitForPresenceOf(String xpathOrCssSelector) { return waitForRenderedElementsToBePresent(xpathOrCssSelector(xpathOrCssSelector)); }</p> <p>public PageObject waitForRenderedElementsToDisappear(final By byElementCriteria) { getRenderedView().waitForElementsToDisappear(byElementCriteria); return this; }</p> <p>public PageObject waitForAbsenceOf(String xpathOrCssSelector) { return waitForRenderedElementsToDisappear(xpathOrCssSelector(xpathOrCssSelector)); }</p> <p>/**</p> <ul> <li>Waits for a given text to appear anywhere on the page. */ public PageObject waitForTextToAppear(final String expectedText) { getRenderedView().waitForText(expectedText); return this; }</li> </ul> <p>public PageObject waitForTitleToAppear(final String expectedTitle) { waitOnPage().until(ExpectedConditions.titleIs(expectedTitle)); return this; }</p> <p>private WebDriverWait waitOnPage() { return new WebDriverWait(driver, getWaitForTimeout().getSeconds()); // waitForTimeoutInSecondsWithAMinimumOfOneSecond()); }</p> <p>public PageObject waitForTitleToDisappear(final String expectedTitle) { getRenderedView().waitForTitleToDisappear(expectedTitle); return this; }</p> <p>/**</p> <ul> <li>Waits for a given text to appear inside the element. */ public PageObject waitForTextToAppear(final WebElement element, final String expectedText) { getRenderedView().waitForText(element, expectedText); return this; }</li> </ul> <p>private boolean driverIsDisabled() { return StepEventBus.getEventBus().webdriverCallsAreSuspended(); }</p> <p>/**</p> <ul> <li>Waits for a given text to disappear from the element. */ public PageObject waitForTextToDisappear(final WebElement element, final String expectedText) { if (!driverIsDisabled()) { waitForCondition().until(elementDoesNotContain(element, expectedText)); } return this; }</li> </ul> <p>private ExpectedCondition<Boolean> elementDoesNotContain(final WebElement element, final String expectedText) { return new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { return !element.getText().contains(expectedText); } }; }</p> <p>public PageObject waitForTextToDisappear(final String expectedText) { return waitForTextToDisappear(expectedText, getWaitForTimeout().toMillis()); }</p> <p>/**</p> <ul> <li> <p>Waits for a given text to not be anywhere on the page. */ public PageObject waitForTextToDisappear(final String expectedText, final long timeoutInMilliseconds) {</p> <p>getRenderedView().waitForTextToDisappear(expectedText, timeoutInMilliseconds); return this; }</p> </li> </ul> <p>/**</p> <ul> <li> <p>Waits for a given text to appear anywhere on the page. */ public PageObject waitForTextToAppear(final String expectedText, final long timeout) {</p> <p>getRenderedView().waitForTextToAppear(expectedText, timeout); return this; }</p> </li> </ul> <p>/**</p> <ul> <li>Waits for any of a number of text blocks to appear anywhere on the</li> <li>screen. */ public PageObject waitForAnyTextToAppear(final String... expectedText) { getRenderedView().waitForAnyTextToAppear(expectedText); return this; }</li> </ul> <p>public PageObject waitForAnyTextToAppear(final WebElement element, final String... expectedText) { getRenderedView().waitForAnyTextToAppear(element, expectedText); return this; }</p> <p>/**</p> <ul> <li>Waits for all of a number of text blocks to appear on the screen. */ public PageObject waitForAllTextToAppear(final String... expectedTexts) { getRenderedView().waitForAllTextToAppear(expectedTexts); return this; }</li> </ul> <p>public PageObject waitForAnyRenderedElementOf(final By... expectedElements) { getRenderedView().waitForAnyRenderedElementOf(expectedElements); return this; }</p> <p>protected void waitABit(final long timeInMilliseconds) { getClock().pauseFor(timeInMilliseconds); }</p> <p>public WaitForBuilder<? extends PageObject> waitFor(int duration) { return new PageObjectStepDelayer(clock, this).waitFor(duration); }</p> <p>public List<WebElement> thenReturnElementList(final By byListCriteria) { return driver.findElements(byListCriteria); }</p> <p>public <T extends PageObject> T foo() { return (T) this; }</p> <p>/**</p> <ul> <li>Check that the specified text appears somewhere in the page. */ public void shouldContainText(final String textValue) { if (!containsText(textValue)) { String errorMessage = String.format( "The text '%s' was not found in the page", textValue); throw new NoSuchElementException(errorMessage); } }</li> </ul> <p>/**</p> <ul> <li>Check that all of the specified texts appears somewhere in the page. */ public void shouldContainAllText(final String... textValues) { if (!containsAllText(textValues)) { String errorMessage = String.format( "One of the text elements in '%s' was not found in the page", (Object[]) textValues); throw new NoSuchElementException(errorMessage); } }</li> </ul> <p>/**</p> <ul> <li>Does the specified web element contain a given text value. Useful for dropdowns and so on.</li> <li> </li> <li>@deprecated use element(webElement).containsText(textValue) */ @Deprecated public boolean containsTextInElement(final WebElement webElement, final String textValue) { return element(webElement).containsText(textValue); }</li> </ul> <p>/*</p> <ul> <li>Check that the element contains a given text.</li> <li>@deprecated use element(webElement).shouldContainText(textValue) */ @Deprecated public void shouldContainTextInElement(final WebElement webElement, final String textValue) { element(webElement).shouldContainText(textValue); }</li> </ul> <p>/*</p> <ul> <li>Check that the element does not contain a given text.</li> <li>@deprecated use element(webElement).shouldNotContainText(textValue) */ @Deprecated public void shouldNotContainTextInElement(final WebElement webElement, final String textValue) { element(webElement).shouldNotContainText(textValue); }</li> </ul> <p>/**</p> <ul> <li>Clear a field and enter a value into it. */ public void typeInto(final WebElement field, final String value) { element(field).type(value); }</li> </ul> <p>/**</p> <ul> <li>Clear a field and enter a value into it.</li> <li>This is a more fluent alternative to using the typeInto method. */ public FieldEntry enter(final String value) { return new FieldEntry(value); }</li> </ul> <p>public void selectFromDropdown(final WebElement dropdown, final String visibleLabel) {</p> <pre><code>Dropdown.forWebElement(dropdown).select(visibleLabel); notifyScreenChange();</code></pre> <p>}</p> <p>public void selectMultipleItemsFromDropdown(final WebElement dropdown, final String... selectedLabels) { Dropdown.forWebElement(dropdown).selectMultipleItems(selectedLabels); notifyScreenChange(); }</p> <p>public Set<String> getSelectedOptionLabelsFrom(final WebElement dropdown) { return Dropdown.forWebElement(dropdown).getSelectedOptionLabels(); }</p> <p>public Set<String> getSelectedOptionValuesFrom(final WebElement dropdown) { return Dropdown.forWebElement(dropdown).getSelectedOptionValues(); }</p> <p>public String getSelectedValueFrom(final WebElement dropdown) { return Dropdown.forWebElement(dropdown).getSelectedValue(); }</p> <p>public String getSelectedLabelFrom(final WebElement dropdown) { return Dropdown.forWebElement(dropdown).getSelectedLabel(); }</p> <p>public void setCheckbox(final WebElement field, final boolean value) { Checkbox checkbox = new Checkbox(field); checkbox.setChecked(value); notifyScreenChange(); }</p> <p>public boolean containsText(final String textValue) { return getRenderedView().containsText(textValue); }</p> <p>/**</p> <ul> <li>Check that the specified text appears somewhere in the page. */ public boolean containsAllText(final String... textValues) { for (String textValue : textValues) { if (!getRenderedView().containsText(textValue)) { return false; } } return true; }</li> </ul> <p>/**</p> <ul> <li>Fail the test if this element is not displayed (rendered) on the screen. */ public void shouldBeVisible(final WebElement field) { element(field).shouldBeVisible(); }</li> </ul> <p>public void shouldBeVisible(final By byCriteria) { waitOnPage().until(ExpectedConditions.visibilityOfElementLocated(byCriteria)); }</p> <p>public void shouldNotBeVisible(final WebElement field) { try { element(field).shouldNotBeVisible(); } catch (NoSuchElementException e) { // A non-existant element is not visible } }</p> <p>public void shouldNotBeVisible(final By byCriteria) { List<WebElement> matchingElements = getDriver().findElements(byCriteria); if (!matchingElements.isEmpty()) { waitOnPage().until(ExpectedConditions.invisibilityOfElementLocated(byCriteria)); } }</p> <p>private long waitForTimeoutInSecondsWithAMinimumOfOneSecond() { return (getWaitForTimeout().getSeconds() < 1) ? 1 : (getWaitForTimeout().getSeconds()); }</p> <p>public long waitForTimeoutInMilliseconds() { return getWaitForTimeout().toMillis(); }</p> <p>public long implicitTimoutMilliseconds() { return getImplicitWaitTimeout().toMillis(); }</p> <p>public String updateUrlWithBaseUrlIfDefined(final String startingUrl) {</p> <pre><code>String baseUrl = pageUrls.getSystemBaseUrl(); if ((baseUrl != null) && (!StringUtils.isEmpty(baseUrl))) { return replaceHost(startingUrl, baseUrl); } else { return startingUrl; }</code></pre> <p>}</p> <p>private String replaceHost(final String starting, final String base) {</p> <pre><code>String updatedUrl = starting; try { URL startingUrl = new URL(starting); URL baseUrl = new URL(base); String startingHostComponent = hostComponentFrom(startingUrl.getProtocol(), startingUrl.getHost(), startingUrl.getPort()); String baseHostComponent = hostComponentFrom(baseUrl.getProtocol(), baseUrl.getHost(), baseUrl.getPort()); updatedUrl = starting.replaceFirst(startingHostComponent, baseHostComponent); } catch (MalformedURLException e) { LOGGER.error("Failed to analyse default page URL: Starting URL: {}, Base URL: {}", starting, base); LOGGER.error("URL analysis failed with exception:", e); } return updatedUrl;</code></pre> <p>}</p> <p>private String hostComponentFrom(final String protocol, final String host, final int port) { StringBuilder hostComponent = new StringBuilder(protocol); hostComponent.append("://"); hostComponent.append(host); if (port > 0) { hostComponent.append(":"); hostComponent.append(port); } return hostComponent.toString(); }</p> <p>/**</p> <ul> <li>Open the webdriver browser using a paramaterized URL. Parameters are</li> <li>represented in the URL using {0}, {1}, etc. */ public final void open(final String[] parameterValues) { open(OpenMode.CHECK_URL_PATTERNS, parameterValues); }</li> </ul> <p>/**</p> <ul> <li>Opens page without checking URL patterns. Same as open(String...)) otherwise. */ public final void openUnchecked(final String... parameterValues) { open(OpenMode.IGNORE_URL_PATTERNS, parameterValues); }</li> </ul> <p>private void open(final OpenMode openMode, final String... parameterValues) { String startingUrl = pageUrls.getStartingUrl(parameterValues); LOGGER.debug("Opening page at url {}", startingUrl); openPageAtUrl(startingUrl); checkUrlPatterns(openMode); initializePage(); LOGGER.debug("Page opened"); }</p> <p>public final void open(final String urlTemplateName, final String[] parameterValues) { open(OpenMode.CHECK_URL_PATTERNS, urlTemplateName, parameterValues); }</p> <p>/**</p> <ul> <li>Opens page without checking URL patterns. Same as {@link #open(String, String[])} otherwise. */ public final void openUnchecked(final String urlTemplateName, final String[] parameterValues) { open(OpenMode.IGNORE_URL_PATTERNS, urlTemplateName, parameterValues); }</li> </ul> <p>private void open(final OpenMode openMode, final String urlTemplateName, final String[] parameterValues) { String startingUrl = pageUrls.getNamedUrl(urlTemplateName, parameterValues); LOGGER.debug("Opening page at url {}", startingUrl); openPageAtUrl(startingUrl); checkUrlPatterns(openMode); initializePage(); LOGGER.debug("Page opened"); }</p> <p>/**</p> <ul> <li>Open the webdriver browser to the base URL, determined by the DefaultUrl</li> <li>annotation if present. If the DefaultUrl annotation is not present, the</li> <li>default base URL will be used. If the DefaultUrl annotation is present, a</li> <li>URL based on the current base url from the system-wide default url</li> <li>and the relative path provided in the DefaultUrl annotation will be used to</li> <li>determine the URL to open. For example, consider the following class:</li> <li> <pre> </li> <li><code></li> <li>@DefaultUrl("<a href="http://localhost:8080/client/list">http://localhost:8080/client/list</a>")</li> <li>public class ClientList extends PageObject {</li> <li>...</li> <li> </li> <li>@WhenPageOpens</li> <li>public void waitUntilTitleAppears() {...}</li> <li>}</li> <li></code></li> <li></pre></li> <li>Suppose you are using a base URL of <a href="http://stage.acme.com">http://stage.acme.com</a>. When you call open() for this class,</li> <li>it will open <a href="http://stage.acme.com/client/list">http://stage.acme.com/client/list</a>. It will then invoke the waitUntilTitleAppears() method. */ final public void open() { open(OpenMode.CHECK_URL_PATTERNS); }</li> </ul> <p>/**</p> <ul> <li>Opens page without checking URL patterns. Same as {@link #open()} otherwise. */ final public void openUnchecked() { open(OpenMode.IGNORE_URL_PATTERNS); }</li> </ul> <p>private void open(final OpenMode openMode) { String startingUrl = updateUrlWithBaseUrlIfDefined(pageUrls.getStartingUrl()); openPageAtUrl(startingUrl); checkUrlPatterns(openMode); initializePage(); }</p> <p>private void initializePage() { addJQuerySupport(); callWhenPageOpensMethods(); }</p> <p>private void checkUrlPatterns(final OpenMode openMode) { if (openMode == OpenMode.CHECK_URL_PATTERNS) { ensurePageIsOnAMatchingUrl(); } }</p> <p>private void ensurePageIsOnAMatchingUrl() { if (!matchesAnyUrl()) { String currentUrl = getDriver().getCurrentUrl(); if (!compatibleWithUrl(currentUrl)) { thisIsNotThePageYourLookingFor(); } } }</p> <p>/**</p> <ul> <li>Use the @At annotation (if present) to check that a page object is displaying the correct page.</li> <li>Will throw an exception if the current URL does not match the expected one. */ public void shouldBeDisplayed() { ensurePageIsOnAMatchingUrl(); }</li> </ul> <p>private void thisIsNotThePageYourLookingFor() {</p> <pre><code>String errorDetails = "This is not the page you're looking for: " + "I was looking for a page compatible with " + this.getClass() + " but " + "I was at the URL " + getDriver().getCurrentUrl(); throw new WrongPageError(errorDetails);</code></pre> <p>}</p> <p>final public void openAt(String relativeUrl) { openPageAtUrl(updateUrlWithBaseUrlIfDefined(relativeUrl)); callWhenPageOpensMethods(); }</p> <p>final public void openUrl(String absoluteUrl) { openPageAtUrl(absoluteUrl); callWhenPageOpensMethods(); }</p> <p>/**</p> <ul> <li> <p>Override this method */ public void callWhenPageOpensMethods() { if (StepEventBus.getEventBus().currentTestIsSuspended()) { return; }</p> <p>for (Method annotatedMethod : methodsAnnotatedWithWhenPageOpens()) { try { annotatedMethod.setAccessible(true); annotatedMethod.invoke(this); } catch (Throwable e) { LOGGER.error("Could not execute @WhenPageOpens annotated method: " + e.getMessage()); if (e instanceof InvocationTargetException) { e = ((InvocationTargetException) e).getTargetException(); } if (AssertionError.class.isAssignableFrom(e.getClass())) { throw (AssertionError) e; } else { throw new UnableToInvokeWhenPageOpensMethods("Could not execute @WhenPageOpens annotated method: "</p> <ul> <li>e.getMessage(), e); } } } }</li> </ul> </li> </ul> <p>private List<Method> methodsAnnotatedWithWhenPageOpens() { List<Method> methods = MethodFinder.inClass(this.getClass()).getAllMethods(); List<Method> annotatedMethods = new ArrayList<>(); for (Method method : methods) { if (method.getAnnotation(WhenPageOpens.class) != null) { if (method.getParameterTypes().length == 0) { annotatedMethods.add(method); } else { throw new UnableToInvokeWhenPageOpensMethods("Could not execute @WhenPageOpens annotated method: WhenPageOpens method cannot have parameters: " + method); } } } return annotatedMethods; }</p> <p>public static String[] withParameters(final String... parameterValues) { return parameterValues; }</p> <p>private void openPageAtUrl(final String startingUrl) { getDriver().get(startingUrl); if (javascriptIsSupportedIn(getDriver())) { addJQuerySupport(); } }</p> <p>public void clickOn(final WebElement webElement) { element(webElement).click(); }</p> <p>/**</p> <ul> <li>Returns true if at least one matching element is found on the page and is visible. */ public Boolean isElementVisible(final By byCriteria) { return getRenderedView().elementIsDisplayed(byCriteria); }</li> </ul> <p>public void setDefaultBaseUrl(final String defaultBaseUrl) { pageUrls.overrideDefaultBaseUrl(defaultBaseUrl); }</p> <p>/**</p> <ul> <li>Returns true if the specified element has the focus.</li> <li> </li> <li>@deprecated Use element(webElement).hasFocus() instead */ public boolean hasFocus(final WebElement webElement) { return element(webElement).hasFocus(); }</li> </ul> <p>public void blurActiveElement() { getJavascriptExecutorFacade().executeScript("document.activeElement.blur();"); }</p> <p>protected JavascriptExecutorFacade getJavascriptExecutorFacade() { if (javascriptExecutorFacade == null) { javascriptExecutorFacade = new JavascriptExecutorFacade(driver); } return javascriptExecutorFacade; }</p> <p>/**</p> <ul> <li>Provides a fluent API for querying web elements. */ public <T extends net.serenitybdd.core.pages.WebElementFacade> T element(WebElement webElement) { return net.serenitybdd.core.pages.WebElementFacadeImpl.wrapWebElement(driver, webElement, getImplicitWaitTimeout().toMillis(), getWaitForTimeout().toMillis(), nameOf(webElement)); }</li> </ul> <p>private String nameOf(WebElement webElement) { try { return webElement.toString(); } catch (Exception e) { return "Unknown web element"; } }</p> <p>public <T extends net.serenitybdd.core.pages.WebElementFacade> T $(WebElement webElement) { return element(webElement); }</p> <p>public <T extends net.serenitybdd.core.pages.WebElementFacade> T $(String xpathOrCssSelector) { return element(xpathOrCssSelector); }</p> <p>/**</p> <ul> <li>Provides a fluent API for querying web elements. */ public <T extends net.serenitybdd.core.pages.WebElementFacade> T element(By bySelector) { return net.serenitybdd.core.pages.WebElementFacadeImpl.wrapWebElement(driver, bySelector, getImplicitWaitTimeout().toMillis(), getWaitForTimeout().toMillis(), bySelector.toString()); }</li> </ul> <p>public <T extends net.serenitybdd.core.pages.WebElementFacade> T find(List<By> selectors) { T element = null; for (By selector : selectors) { if (element == null) { element = element(selector); } else { element = element.find(selector); } } return element; }</p> <p>public <T extends net.serenitybdd.core.pages.WebElementFacade> T find(By... selectors) { return find(NewList.of(selectors)); }</p> <p>public List<WebElementFacade> findAll(By bySelector) {</p> <pre><code>List<WebElement> matchingWebElements = driver.findElements(bySelector); List<WebElementFacade> allElements = new ArrayList<>(); for (WebElement matchingElement : matchingWebElements) { allElements.add($(matchingElement)); } return allElements;</code></pre> <p>}</p> <p>/**</p> <ul> <li>Provides a fluent API for querying web elements. */ public <T extends net.serenitybdd.core.pages.WebElementFacade> T element(String xpathOrCssSelector) { return element(xpathOrCssSelector(xpathOrCssSelector)); }</li> </ul> <p>public <T extends net.serenitybdd.core.pages.WebElementFacade> T findBy(String xpathOrCssSelector) { return element(xpathOrCssSelector); }</p> <p>public List<net.serenitybdd.core.pages.WebElementFacade> findAll(String xpathOrCssSelector) { return findAll(xpathOrCssSelector(xpathOrCssSelector)); }</p> <p>public boolean containsElements(By bySelector) { return !findAll(bySelector).isEmpty(); }</p> <p>public boolean containsElements(String xpathOrCssSelector) { return !findAll(xpathOrCssSelector).isEmpty(); }</p> <p>public Object evaluateJavascript(final String script) { addJQuerySupport(); JavascriptExecutorFacade js = new JavascriptExecutorFacade(driver); return js.executeScript(script); }</p> <p>public Object evaluateJavascript(final String script, final Object... params) { addJQuerySupport(); JavascriptExecutorFacade js = new JavascriptExecutorFacade(driver); return js.executeScript(script, params); }</p> <p>public void addJQuerySupport() { if (pageIsLoaded() && jqueryIntegrationIsActivated() && driverIsJQueryCompatible()) { JQueryEnabledPage jQueryEnabledPage = JQueryEnabledPage.withDriver(getDriver()); jQueryEnabledPage.activateJQuery(); } }</p> <p>protected boolean driverIsJQueryCompatible() { try { if (getDriver() instanceof WebDriverFacade) { return SupportedWebDriver.forClass(((WebDriverFacade) getDriver()).getDriverClass()) .supportsJavascriptInjection(); } return SupportedWebDriver.forClass(getDriver().getClass()).supportsJavascriptInjection(); } catch (IllegalArgumentException probablyAMockedDriver) { return false; } }</p> <p>private Boolean jqueryIntegrationIsActivated() { return THUCYDIDES_JQUERY_INTEGRATION.booleanFrom(environmentVariables, true); }</p> <p>public RadioButtonGroup inRadioButtonGroup(String name) { return new RadioButtonGroup(getDriver().findElements(By.name(name))); }</p> <p>private boolean pageIsLoaded() { try { return (driverIsInstantiated() && getDriver().getCurrentUrl() != null); } catch (WebDriverException e) { return false; } }</p> <p>protected boolean driverIsInstantiated() { if (getDriver() instanceof WebDriverFacade) { return ((WebDriverFacade) getDriver()).isEnabled() && ((WebDriverFacade) getDriver()).isInstantiated(); } return true; }</p> <p>public ThucydidesFluentWait<WebDriver> waitForWithRefresh() { return new FluentWaitWithRefresh<>(driver, webdriverClock, sleeper) .withTimeout(getWaitForTimeout().toMillis(), TimeUnit.MILLISECONDS) .pollingEvery(WAIT_FOR_ELEMENT_PAUSE_LENGTH, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); }</p> <p>public ThucydidesFluentWait<WebDriver> waitForCondition() { return new NormalFluentWait<>(driver, webdriverClock, sleeper) .withTimeout(getWaitForTimeout().toMillis(), TimeUnit.MILLISECONDS) .pollingEvery(WAIT_FOR_ELEMENT_PAUSE_LENGTH, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); }</p> <p>public WebElementFacade waitFor(WebElement webElement) { return getRenderedView().waitFor(webElement); }</p> <p>public WebElementFacade waitFor(WebElementFacade webElement) { return getRenderedView().waitFor(webElement); }</p> <p>public Alert getAlert() { return driver.switchTo().alert(); }</p> <p>public Actions withAction() { WebDriver proxiedDriver = (getDriver() instanceof WebElementFacade) ? ((WebDriverFacade) getDriver()).getProxiedDriver() : getDriver(); return new Actions(proxiedDriver); }</p> <p>public class FieldEntry {</p> <pre><code>private final String value; public FieldEntry(final String value) { this.value = value; } public void into(final WebElement field) { element(field).type(value); } public void into(final net.serenitybdd.core.pages.WebElementFacade field) { field.type(value); } public void intoField(final By bySelector) { WebElement field = getDriver().findElement(bySelector); into(field); }</code></pre> <p>}</p> <p>private void notifyScreenChange() { StepEventBus.getEventBus().notifyScreenChange(); }</p> <p>protected ThucydidesFluentAdapter fluent() { return new ThucydidesFluentAdapter(getDriver()); }</p> <p>public <T extends WebElementFacade> T moveTo(String xpathOrCssSelector) { if (!driverIsDisabled()) { withAction().moveToElement(findBy(xpathOrCssSelector)).perform(); } return findBy(xpathOrCssSelector); }</p> <p>public <T extends WebElementFacade> T moveTo(By locator) { if (!driverIsDisabled()) { withAction().moveToElement(find(locator)).perform(); } return find(locator); }</p> <p>public void waitForAngularRequestsToFinish() { JavascriptCompatibleVersion.of(getDriver()).ifPresent( driver -> new NgWebDriver(driver).waitForAngularRequestsToFinish() ); }</p> <p>Inflector inflection = Inflector.getInstance();</p> <p>@Override public String toString() { return inflection.of(getClass().getSimpleName()) .inHumanReadableForm().toString(); } }</p> </li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>"The page object class com.Nothing.weeklyCashBalancing.pageobjects.Homepage looks dodgy" - I need to see the <code>com.Nothing.weeklyCashBalancing.pageobjects.Homepage</code> class.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>package com.johnlewis.weeklyCashBalancing.pageobjects;</p> <p>import net.serenitybdd.core.annotations.findby.FindBy; import net.serenitybdd.core.pages.WebElementFacade; import net.thucydides.core.annotations.WhenPageOpens; import net.thucydides.core.pages.PageObject; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver;</p> <p>public class Homepage extends PageObject {</p> <pre><code>@WhenPageOpens public void BrowserMaximize(){ getDriver().manage().window().maximize(); } @FindBy(id = "j_username") WebElementFacade userId; @FindBy(id = "j_password") WebElementFacade password; @FindBy(id = "submitButton") WebElementFacade signInBtn; @FindBy(id = "branchNumber") WebElementFacade branchName; @FindBy(id = "submit") WebElementFacade submitButton; @FindBy(id="headerSystemTitle") WebElementFacade titleOfPage; public void signInToMyAccount(String uId, String password) { userId.waitUntilVisible().sendKeys(uId); this.password.waitUntilVisible().sendKeys(password); signInBtn.waitUntilVisible().click(); } public void selectBranch(String brName){ branchName.selectByVisibleText(brName); submitButton.waitUntilVisible().click(); } public String verifyTitle(String pageTitle) { if (titleOfPage.getText().equalsIgnoreCase(pageTitle)) return "User on \""+titleOfPage.getText()+"\" Screen"; else return "Enter the correct details"; }</code></pre> <p>}</p> <p>package net.thucydides.core.pages;</p> <p>import net.serenitybdd.core.environment.ConfiguredEnvironment; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.core.pages.PageObjects; import net.thucydides.core.annotations.Fields; import net.thucydides.core.steps.EnclosingClass; import net.thucydides.core.webdriver.Configuration; import net.thucydides.core.webdriver.WebDriverFacade; import net.thucydides.core.webdriver.WebdriverProxyFactory; import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.slf4j.Logger; import org.slf4j.LoggerFactory;</p> <p>import java.io.Serializable; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.Arrays;</p> <p>import static org.apache.commons.lang3.StringUtils.isNotEmpty;</p> <p>/**</p> <ul> <li>The Pages object keeps track of what web pages a test visits, and helps with mapping pages to Page Objects.</li> <li>A Pages object is associated with a WebDriver driver instance, so you need a Pages object for any</li> <li>given WebDriver driver.</li> <li> </li> <li> <p>@author johnsmart */ public class Pages implements Serializable {</p> <p>private static final long serialVersionUID = 1L;</p> <p>private transient WebDriver driver;</p> <p>private static final Logger LOGGER = LoggerFactory.getLogger(Pages.class);</p> <p>private String defaultBaseUrl;</p> <p>private final Configuration configuration;</p> <p>private WebdriverProxyFactory proxyFactory;</p> <p>private transient boolean usePreviousPage = false;</p> <p>public Pages(Configuration configuration) { this.configuration = configuration; proxyFactory = WebdriverProxyFactory.getFactory(); }</p> <p>public Pages() { this(ConfiguredEnvironment.getConfiguration()); }</p> <p>public Pages(final WebDriver driver) { this(ConfiguredEnvironment.getConfiguration()); this.driver = driver; }</p> <p>public Pages(final WebDriver driver, Configuration configuration) { this(configuration); this.driver = driver; }</p> <p>public void setDriver(final WebDriver driver) { this.driver = driver; }</p> <p>public WebDriver getDriver() { return driver; }</p> <p>protected WebdriverProxyFactory getProxyFactory() { return proxyFactory; }</p> <p>public Configuration getConfiguration() { return configuration; }</p> <p>PageObject currentPage = null;</p> <p>public <T extends PageObject> T getAt(final Class<T> pageObjectClass) { return getPage(pageObjectClass); }</p> <p>public <T extends PageObject> T getPage(final Class<T> pageObjectClass) { T pageCandidate = getCurrentPageOfType(pageObjectClass); pageCandidate.setDefaultBaseUrl(getDefaultBaseUrl()); return pageCandidate; }</p> <p>@SuppressWarnings("unchecked") public <T extends PageObject> T get(final Class<T> pageObjectClass) { T nextPage; if (shouldUsePreviousPage(pageObjectClass)) { nextPage = (T) currentPage; } else { T pageCandidate = getCurrentPageOfType(pageObjectClass); pageCandidate.setDefaultBaseUrl(getDefaultBaseUrl()); cacheCurrentPage(pageCandidate); nextPage = pageCandidate; } usePreviousPage = false; return nextPage; }</p> <p>@SuppressWarnings("unchecked") public <T extends PageObject> T currentPageAt(final Class<T> pageObjectClass) { T nextPage; if (shouldUsePreviousPage(pageObjectClass)) { nextPage = (T) currentPage; } else { T pageCandidate = getCurrentPageOfType(pageObjectClass); pageCandidate.setDefaultBaseUrl(getDefaultBaseUrl()); openBrowserIfRequiredFor(pageCandidate); checkUrlPatterns(pageObjectClass, pageCandidate); cacheCurrentPage(pageCandidate); nextPage = pageCandidate; nextPage.addJQuerySupport(); } usePreviousPage = false; return nextPage; }</p> <p>private <T extends PageObject> void openBrowserIfRequiredFor(T pageCandidate) { if (browserNotOpen()) { openHeadlessDriverIfNotOpen(); pageCandidate.open(); } }</p> <p>private void openHeadlessDriverIfNotOpen() { if (browserIsHeadless()) { driver.get("about:blank"); } }</p> <p>private boolean browserNotOpen() { if (getDriver() instanceof WebDriverFacade) { return !((WebDriverFacade) getDriver()).isInstantiated(); } else { return StringUtils.isEmpty(getDriver().getCurrentUrl()); } }</p> <p>private boolean browserIsHeadless() { if (getDriver() instanceof WebDriverFacade) { return (((WebDriverFacade) getDriver()).getProxiedDriver() instanceof HtmlUnitDriver); } else { return (getDriver() instanceof HtmlUnitDriver); } } private <T extends PageObject> void checkUrlPatterns(Class<T> pageObjectClass, T pageCandidate) { if (!pageCandidate.matchesAnyUrl()) { String currentUrl = getDriver().getCurrentUrl(); if (!pageCandidate.compatibleWithUrl(currentUrl)) { thisIsNotThePageYourLookingFor(pageObjectClass); } } }</p> <p>private <T extends PageObject> boolean shouldUsePreviousPage(final Class<T> pageObjectClass) { if (!usePreviousPage) { return false; } else { return currentPageIsSameTypeAs(pageObjectClass); } }</p> <p>private void cacheCurrentPage(PageObject newPage) { this.currentPage = newPage; }</p> <p>private <T extends PageObject> boolean currentPageIsSameTypeAs(Class<T> pageObjectClass) { return (currentPage != null) && (currentPage.getClass().equals(pageObjectClass)); }</p> <p>public boolean isCurrentPageAt(final Class<? extends PageObject> pageObjectClass) { try { PageObject pageCandidate = getCurrentPageOfType(pageObjectClass); String currentUrl = getDriver().getCurrentUrl(); return pageCandidate.compatibleWithUrl(currentUrl); } catch (WrongPageError e) { return false; } }</p> <p>/**</p> <ul> <li>Create a new Page Object of the given type.</li> <li>The Page Object must have a constructor</li> <li> </li> <li>@param pageObjectClass</li> <li> <p>@throws IllegalArgumentException */ @SuppressWarnings("unchecked") private <T extends PageObject> T getCurrentPageOfType(final Class<T> pageObjectClass) { T currentPage = null; try { currentPage = createFromSimpleConstructor(pageObjectClass); if (currentPage == null) { currentPage = createFromConstructorWithWebdriver(pageObjectClass); } if (hasPageFactoryProperty(currentPage)) { setPageFactory(currentPage); }</p> <p>} catch (NoSuchMethodException e) { LOGGER.warn("This page object does not appear have a constructor that takes a WebDriver parameter: {} ({})", pageObjectClass, e.getMessage()); thisPageObjectLooksDodgy(pageObjectClass, "This page object does not appear have a constructor that takes a WebDriver parameter"); } catch (InvocationTargetException e) { // Unwrap the underlying exception LOGGER.warn("Failed to instantiate page of type {} ({})", pageObjectClass, e.getTargetException()); thisPageObjectLooksDodgy(pageObjectClass,"Failed to instantiate page (" + e.getTargetException() +")"); }catch (Exception e) { //shouldn't even get here LOGGER.warn("Failed to instantiate page of type {} ({})", pageObjectClass, e); thisPageObjectLooksDodgy(pageObjectClass,"Failed to instantiate page (" + e +")"); } return currentPage; }</p> </li> </ul> <p>private <T extends PageObject> T createFromSimpleConstructor(Class<T> pageObjectClass) throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchFieldException { T newPage = null; try { if (hasDefaultConstructor(pageObjectClass)) { Class[] constructorArgs = new Class[0]; Constructor<? extends PageObject> constructor = pageObjectClass.getConstructor(constructorArgs); newPage = (T) constructor.newInstance(); newPage.setDriver(driver); } else if (hasOuterClassConstructor(pageObjectClass)) { Constructor<? extends PageObject> constructor = pageObjectClass.getConstructor(new Class[] {pageObjectClass.getEnclosingClass()}); newPage = (T) constructor.newInstance(EnclosingClass.of(pageObjectClass).newInstance()); newPage.setDriver(driver); }</p> <pre><code>} catch (NoSuchMethodException e) { // Try a different constructor } return newPage;</code></pre> <p>}</p> <p>private <T extends PageObject> boolean hasDefaultConstructor(Class<T> pageObjectClass) { return Arrays.stream(pageObjectClass.getConstructors()) .anyMatch( constructor -> constructor.getParameters().length == 0 ); }</p> <p>private <T extends PageObject> boolean hasOuterClassConstructor(Class<T> pageObjectClass) { return Arrays.stream(pageObjectClass.getConstructors()) .anyMatch( constructor -> constructor.getParameters().length == 1 && constructor.getParameters()[0].getType() == pageObjectClass.getEnclosingClass() ); }</p> <p>private <T extends PageObject> T createFromConstructorWithWebdriver(Class<T> pageObjectClass) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Class[] constructorArgs = new Class[1]; constructorArgs[0] = WebDriver.class; Constructor<? extends PageObject> constructor = pageObjectClass.getConstructor(constructorArgs); return (T) constructor.newInstance(driver); }</p> <p>private boolean hasPageFactoryProperty(Object pageObject) { java.util.Optional<Field> pagesField = Fields.of(pageObject.getClass()).withName("pages"); return ((pagesField.isPresent()) && (pagesField.get().getType() == Pages.class)); }</p> <p>private void setPageFactory(Object pageObject) throws IllegalAccessException { Fields.of(pageObject.getClass()).withName("pages").ifPresent( field -> assignTo(field, pageObject) ); }</p> <p>private void assignTo(Field pagesField, Object pageObject) { try { pagesField.setAccessible(true); pagesField.set(pageObject, this); } catch (IllegalAccessException e) { LOGGER.warn("Failed to assign page object field: ", e); } }</p> <p>private void thisPageObjectLooksDodgy(final Class<? extends PageObject> pageObjectClass, String message) {</p> <pre><code>String errorDetails = "The page object " + pageObjectClass + " looks dodgy:\n" + message; throw new WrongPageError(errorDetails);</code></pre> <p>}</p> <p>private void thisIsNotThePageYourLookingFor(final Class<? extends PageObject> pageObjectClass) {</p> <pre><code>String errorDetails = "This is not the page you're looking for: " + "I was looking for a page compatible with " + pageObjectClass + " but " + "I was at the URL " + getDriver().getCurrentUrl(); throw new WrongPageError(errorDetails);</code></pre> <p>}</p> <p>/**</p> <ul> <li> <p>The default URL for this set of tests, or the system default URL if undefined. */ public String getDefaultBaseUrl() {</p> <p>String baseUrl = defaultBaseUrl; if (isNotEmpty(getConfiguration().getBaseUrl())) { baseUrl = getConfiguration().getBaseUrl(); } return baseUrl; }</p> </li> </ul> <p>/**</p> <ul> <li>Set a default base URL for a specific set of tests. */ public void setDefaultBaseUrl(final String defaultBaseUrl) { this.defaultBaseUrl = defaultBaseUrl; }</li> </ul> <p>public Pages onSamePage() { usePreviousPage = true; return this; }</p> <p>public static <T extends PageObject> T instrumentedPageObjectUsing(Class<T> pageObjectClass, WebDriver driver) { return PageObjects.usingDriver(driver).ofType(pageObjectClass); } }</p> </li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>package com.johnlewis.weeklyCashBalancing.pageobjects;</p> <p>import net.serenitybdd.core.annotations.findby.FindBy; import net.serenitybdd.core.pages.WebElementFacade; import net.thucydides.core.annotations.WhenPageOpens; import net.thucydides.core.pages.PageObject; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver;</p> <p>public class Homepage extends PageObject {</p> <pre><code>@WhenPageOpens public void BrowserMaximize(){ getDriver().manage().window().maximize(); } @FindBy(id = "j_username") WebElementFacade userId; @FindBy(id = "j_password") WebElementFacade password; @FindBy(id = "submitButton") WebElementFacade signInBtn; @FindBy(id = "branchNumber") WebElementFacade branchName; @FindBy(id = "submit") WebElementFacade submitButton; @FindBy(id="headerSystemTitle") WebElementFacade titleOfPage; public void signInToMyAccount(String uId, String password) { userId.waitUntilVisible().sendKeys(uId); this.password.waitUntilVisible().sendKeys(password); signInBtn.waitUntilVisible().click(); } public void selectBranch(String brName){ branchName.selectByVisibleText(brName); submitButton.waitUntilVisible().click(); } public String verifyTitle(String pageTitle) { if (titleOfPage.getText().equalsIgnoreCase(pageTitle)) return "User on \""+titleOfPage.getText()+"\" Screen"; else return "Enter the correct details"; }</code></pre> <p>}</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>I don't think it is the page object - the best thing would be to place a breakpoint in the code (Pages.java:223) to see exactly why it is failing.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>its send the error message of failing.its a catch block</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>You will need to look at the exception and find the root cause exception. It might appear in the logs when the test fails.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>its going to line no 290 & showing @message. private void thisPageObjectLooksDodgy(final Class<? extends PageObject> pageObjectClass, String message) {</p> <pre><code> String errorDetails = "The page object " + pageObjectClass + " looks dodgy:\n" + message; throw new WrongPageError(errorDetails); }</code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>I would need to walk through the code in a remote session to trouble-shoot this. Does your company have a commercial support contract for Serenity?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>no</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>If your company is using Serenity in a commercial context, it would be worthwhile for them to look at the support options (<a href="https://johnfergusonsmart.com/serenity-bdd-mentoring/">https://johnfergusonsmart.com/serenity-bdd-mentoring/</a>). It is much easier than via email exchanges.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <h1>in SmartElementProxyCreator class throwing the error in this method</h1> <h1>public void proxyElements(PageObject pageObject, WebDriver driver, int timeoutInSeconds) { ElementLocatorFactory finder = locatorFactories().withTimeout(timeoutInSeconds).getLocatorFor(driver); PageFactory.initElements(new SmartFieldDecorator(finder, driver, pageObject), pageObject); }</h1> <p>package net.thucydides.core.annotations.locators;</p> <p>import net.serenitybdd.core.environment.ConfiguredEnvironment; import net.serenitybdd.core.pages.PageObject; import net.thucydides.core.webdriver.Configuration; import net.thucydides.core.webdriver.ElementLocatorFactorySelector; import net.thucydides.core.webdriver.ElementProxyCreator; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.pagefactory.ElementLocatorFactory;</p> <p>public class SmartElementProxyCreator implements ElementProxyCreator {</p> <pre><code>@Override public void proxyElements(PageObject pageObject, WebDriver driver) { PageFactory.initElements(new SmartFieldDecorator(locatorFactories().getLocatorFor(driver), driver, pageObject), pageObject); } @Override public void proxyElements(PageObject pageObject, WebDriver driver, int timeoutInSeconds) { ElementLocatorFactory finder = locatorFactories().withTimeout(timeoutInSeconds).getLocatorFor(driver); PageFactory.initElements(new SmartFieldDecorator(finder, driver, pageObject), pageObject); } private ElementLocatorFactorySelector locatorFactories() { Configuration configuration = ConfiguredEnvironment.getConfiguration(); return new ElementLocatorFactorySelector(configuration); }</code></pre> <p>}</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>I'm fairly familiar with the Serenity code - I'm more interested in the contents of the exceptions, not which Serenity methods throw them.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>There are a lot of things to go through in that code base. Since it is project-specific support and not a Serenity defect, it could only be looked at as part of a support contract.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>Hi John, after all debug in the error here the code which getting the error,</p> <pre><code> try { return (DriverSource) Class.forName(providedImplementation).newInstance(); } catch (Exception e) { throw new RuntimeException("Could not instantiate the custom webdriver provider of type " + providedImplementation); }</code></pre> <h1>its not able to find the class where i am providing the webdriver.</h1> <p>package net.thucydides.core.webdriver;</p> <p>import com.google.common.base.Preconditions; import net.thucydides.core.ThucydidesSystemProperty; import net.thucydides.core.util.EnvironmentVariables;</p> <p>import static net.thucydides.core.webdriver.WebDriverFactory.getDriverFrom;</p> <p>/**</p> <ul> <li>A description goes here.</li> <li>User: john</li> <li>Date: 7/03/2014</li> <li> <p>Time: 12:39 PM */ public class ProvidedDriverConfiguration {</p> <p>private final EnvironmentVariables environmentVariables;</p> <p>public ProvidedDriverConfiguration(EnvironmentVariables environmentVariables) { this.environmentVariables = environmentVariables; }</p> <p>public boolean isProvided() { return getDriverFrom(environmentVariables).equals("provided"); }</p> <p>**public DriverSource getDriverSource() { String providedDriverType = getDriverName(); Preconditions.checkNotNull(providedDriverType, "No provider type was specified in 'webdriver.provided.type'");</p> <pre><code>String providedImplementation = environmentVariables.getProperty("webdriver.provided." + providedDriverType); Preconditions.checkNotNull(providedImplementation, "No provider implementation was specified in 'webdriver.provided.'" + providedDriverType); try { return (DriverSource) Class.forName(providedImplementation).newInstance(); } catch (Exception e) { throw new RuntimeException("Could not instantiate the custom webdriver provider of type " + providedImplementation); }</code></pre> <p>}**</p> <p>public String getDriverName() { return environmentVariables.getProperty(ThucydidesSystemProperty.WEBDRIVER_PROVIDED_TYPE); } }</p> </li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <h1>when i am evaluate that try getting no class found exception Method threw 'java.lang.ClassNotFoundException' exception.</h1> <p>String providedDriverType = getDriverName(); its getting as "mydriver"</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>You don't need to use a provided driver for your code.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mahesht36"><img src="https://avatars.githubusercontent.com/u/50178112?v=4" />mahesht36</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>what should i use in that place</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wakaleo"><img src="https://avatars.githubusercontent.com/u/55986?v=4" />wakaleo</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p><a href="https://serenity-bdd.github.io/theserenitybook/latest/web-testing-in-serenity.html">https://serenity-bdd.github.io/theserenitybook/latest/web-testing-in-serenity.html</a></p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>