実際、平静のためにデフォルトのWebドライバーを変更しようとすると苦労しています。実際には、セレン グリッドでテストを実行したいと考えています。次に、 PageObject を拡張するクラスに次のコードを追加します。
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setPlatform(Platform.WINDOWS);
cap.setCapability("marionette",false);
ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffprofile = profile.
getProfile("JbehaveProfile");
cap.setCapability(FirefoxDriver.PROFILE, ffprofile);
//cap.setVersion("46.0.1");
URL url = new URL("http://localhost:4444/wd/hub");
WebDriver driver = new RemoteWebDriver(url,cap);
Serenity.getWebdriverManager().registerDriver(driver);
Serenity.getWebdriverManager().setCurrentDriver(driver);
しかし、それは機能していません。エラーヌルポインタ例外を与えます。SerenityでSeleniumグリッドを設定する方法を教えてください。ありがとう。
java.lang.NullPointerException
at testSeleniumGrid.pages.DictionaryPage.setProfileFirefox(DictionaryPage.java:70)
at testSeleniumGrid.steps.serenity.EndUserSteps.is_the_home_page(EndUserSteps.java:35)
at testSeleniumGrid.steps.serenity.EndUserSteps$$EnhancerByCGLIB$$6d97ef9c.CGLIB$is_the_home_page$3(<generated>)
at testSeleniumGrid.steps.serenity.EndUserSteps$$EnhancerByCGLIB$$6d97ef9c$$FastClassByCGLIB$$53eb4f32.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:348)
at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:333)
at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:308)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:130)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:57)
at testSeleniumGrid.steps.serenity.EndUserSteps$$EnhancerByCGLIB$$6d97ef9c.is_the_home_page(<generated>)
at testSeleniumGrid.steps.DefinitionSteps.givenTheUserIsOnTheWikionaryHomePage(DefinitionSteps.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:595)
at org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:566)
at org.jbehave.core.embedder.StoryRunner.runStepsWhileKeepingState(StoryRunner.java:546)
at org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:510)
at org.jbehave.core.embedder.StoryRunner.runStepsWithLifecycle(StoryRunner.java:476)
at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:336)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:239)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:182)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:266)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:233)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)