2015-04-07 33 views
0

當我運行我的代碼時,出現錯誤。我正在使用Selenium網格在遠程服務器上運行我的代碼。雖然當我在我的本地機器上運行代碼工作正常。Sikuli拋出異常org.sikuli.api.robot.desktop.DesktopScreen.getSize

誤差-----------

`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) 
 
    `

系統

視窗服務器R2數據中心/ 64位操作系統 sikuli 1.0.2

+0

什麼是代碼? – mmmmmpie

回答

1

您的遠程服務器是否有UI?或者當您運行此操作時是否存在活動的桌面會話? Sikuli需要一個活動的桌面會話(在遠程服務器上,這通常需要有人通過RDP或VNC登錄)。

+0

aholt是正確的。正確的異常說 - 導致:java.awt.HeadlessException: 沒有設置X11 DISPLAY變量,但此程序執行需要它的操作。 –