当我运行我的代码时,我遇到了错误。我正在使用Selenium网格在远程服务器上运行我的代码。虽然当我运行我的本地机器代码工作正常。
错误是-----------
`java.lang.ExceptionInInitializerError
at org.sikuli.api.robot.desktop.DesktopScreen.getSize(DesktopScreen.java:43)
at org.sikuli.api.AbstractScreenRegion.<init>(AbstractScreenRegion.java:19)
at org.sikuli.api.DefaultScreenRegion.<init>(DefaultScreenRegion.java:37)
at org.sikuli.api.DesktopScreenRegion.<init>(DesktopScreenRegion.java:11)
at com.test.accenture.acp.onboardoperation.OnboardingOperationScenario.I_click_on_Choose_file(OnboardingOperationScenario.java:3596)
at ✽.Then I click on Choose file(com/test/accenture/acp/onboardoperation/0002CreateBlueprint.feature:19)
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at sun.java2d.HeadlessGraphicsEnvironment.getScreenDevices(HeadlessGraphicsEnvironment.java:72)
at org.sikuli.api.robot.desktop.AWTDesktop.<clinit>(AWTDesktop.java:27)
at org.sikuli.api.robot.desktop.DesktopScreen.getSize(DesktopScreen.java:43)
at org.sikuli.api.AbstractScreenRegion.<init>(AbstractScreenRegion.java:19)
at org.sikuli.api.DefaultScreenRegion.<init>(DefaultScreenRegion.java:37)
at org.sikuli.api.DesktopScreenRegion.<init>(DesktopScreenRegion.java:11)
at com.test.accenture.acp.onboardoperation.OnboardingOperationScenario.I_click_on_Choose_file(OnboardingOperationScenario.java:3596)
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 cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:37)
at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:44)
at cucumber.runtime.Runtime.runStep(Runtime.java:223)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:36)
at cucumber.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:76)
at cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:65)
at cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:20)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.FeatureRunner.run(FeatureRunner.java:72)
at cucumber.junit.Cucumber.runChild(Cucumber.java:75)
at cucumber.junit.Cucumber.runChild(Cucumber.java:36)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.Cucumber.run(Cucumber.java:80)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
`
系统
Windows服务器R2数据中心/ 64位操作系统 sikuli 1.0.2
答案 0 :(得分:1)
您的远程服务器是否有用户界面?或者在运行时有活动的桌面会话吗? Sikuli需要一个活动的桌面会话(在远程服务器上,这通常需要有人通过RDP或VNC登录)。