【问题标题】:Lauching swing applicaiton which has exe extention in marathon java driver在马拉松 Java 驱动程序中启动具有 exe 扩展名的 Swing 应用程序
【发布时间】:2022-06-17 01:47:04
【问题描述】:

我们有一个扩展名为 .exe 的 java swing 应用程序,那么如何配置 JavaProfile() 以使用 Marathon JavaDriver 启动?

JavaProfile profile = new JavaProfile(JavaProfile.LaunchMode.EXECUTABLE_JAR);
            profile.setLaunchType(JavaProfile.LaunchType.SWING_APPLICATION);
            profile.setExecutableJar("C:\\DIR\\TO\\APP\\JavaCalc.exe");

JavaDriver calculatorSession = new JavaDriver(profile);

我试过这个,但它似乎不正确,也抛出了异常。

Jun 09, 2022 5:04:28 PM net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor start
INFO: Executing: [C:\Users\robot\.jdks\corretto-11.0.15\bin\java.exe, -jar, C:\DIR\TO\APP\JavaCalc.exe][ {JAVA_TOOL_OPTIONS=-DkeepLog=false -Dmarathon.launch.mode=executablejar -Dmarathon.mode=playing -javaagent:"C:\Users\robot\.m2\repository\com\jaliansystems\marathon-java-agent\5.4.0.0\marathon-java-agent-5.4.0.0.jar"=57191}]
Error: Invalid or corrupt jarfile C:\DIR\TO\APP\JavaCalc.exe
Jun 09, 2022 5:04:32 PM net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor start
WARNING: The application exited before establishing the connection: [C:\Users\robot\.jdks\corretto-11.0.15\bin\java.exe, -jar, C:\DIR\TO\APP\JavaCalc.exe][ {JAVA_TOOL_OPTIONS=-DkeepLog=false -Dmarathon.launch.mode=executablejar -Dmarathon.mode=playing -javaagent:"C:\Users\robot\.m2\repository\com\jaliansystems\marathon-java-agent\5.4.0.0\marathon-java-agent-5.4.0.0.jar"=57191}]
org.openqa.selenium.WebDriverException: The application exited before establishing the connection
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'ROBOT', ip: '192.168.1.114', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_332'
Driver info: driver.version: JavaDriver
    at net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor.start(JavaDriverCommandExecutor.java:103)
    at net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor.execute(JavaDriverCommandExecutor.java:129)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at net.sourceforge.marathon.javadriver.JavaDriver.<init>(JavaDriver.java:156)
    at net.sourceforge.marathon.javadriver.JavaDriver.<init>(JavaDriver.java:131)
    at net.sourceforge.marathon.javadriver.JavaDriver.<init>(JavaDriver.java:112)
    at CalculatorMarathonTest.setUp(CalculatorMarathonTest.java:23)
    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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
    at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:176)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:122)
    at java.util.ArrayList.forEach(ArrayList.java:1259)
    at org.testng.TestRunner.privateRun(TestRunner.java:766)
    at org.testng.TestRunner.run(TestRunner.java:587)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
    at org.testng.SuiteRunner.run(SuiteRunner.java:286)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1109)
    at org.testng.TestNG.runSuites(TestNG.java:1039)
    at org.testng.TestNG.run(TestNG.java:1007)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)```

【问题讨论】:

  • 1) "..and 也会抛出异常。" 既然有很多,为什么不包括哪一个的信息呢?我的意思是复制/粘贴堆栈跟踪本身。 2)如需更好的帮助,请edit添加minimal reproducible example

标签: java swing marathon marathontesting


【解决方案1】:

Marathon 为运行它的 java 代理和端口设置 JAVA_TOOL_OPTIONS。所以你的可执行文件可能会过度写入属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-06
    相关资源
    最近更新 更多