尝试运行下面的应用程序,代码与实际设备交互,启动应用程序并立即关闭,尝试4-5次然后我得到以下错误:
import java.io.File;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.ios.IOSDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class testone
{
public static IOSDriver driver;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
File appDir = new File ("//Users//gangaiahl//Appium//jars//CarApp//Payload");
File app = new File (appDir,"Car.app");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("deviceName", "Car_iPhone_6");
capabilities.setCapability("platformVersion", "9.2.1");
capabilities.setCapability("device", "iPhone 6");
capabilities.setCapability("app",app.getAbsolutePath());
capabilities.setCapability("u_did", "840384833537f40d011032eaaf20a53705a451ce");
capabilities.setCapability("bundle_id", "au.dev.com.onewaytraffic.car");
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void test() {
System.out.println("Hello");
}
}
[TestNG] Running:
/private/var/folders/05/79kfthm94qjd3bngd2l5pv7r0mx69v/T/testng-eclipse-1075004287/testng-customsuite.xml
FAILED CONFIGURATION: @BeforeClass setUpBeforeClass
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Instruments crashed on startup) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 50.98 seconds
Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17'
System info: host: 'NCA047065', ip: '10.65.210.86', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.7.0_79'
Driver info: io.appium.java_client.ios.IOSDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:109)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:23)
at testone.setUpBeforeClass(testone.java:51)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
SKIPPED: test
===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 0
===============================================
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 73 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@45fe425: 37 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@5cb1e877: 37 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@11b5b834: 52 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@16debe8: 123 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@262f4873: 20 ms
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}
info: <-- GET /wd/hub/status 200 1.504 ms - 105 {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 timed[778] <Notice>: (Note ) CoreTime: Received time 05/03/2016 23:48:16±0.00 from "NTP"
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 timed[778] <Notice>: (Note ) CoreTime: Received time 05/03/2016 23:48:16±0.00 from "NTP"
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 syslogd[25] <Notice>: ASL Sender Statistics
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 syslogd[25] <Notice>: ASL Sender Statistics
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 timed[778] <Notice>: (Note ) CoreTime: Want active time in 38.66min. Need active time in 8330.33min. Remaining retry interval: 14.980051min.
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 timed[778] <Notice>: (Note ) CoreTime: Want active time in 38.66min. Need active time in 8330.33min. Remaining retry interval: 14.980051min.
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 UserEventAgent[26] <Error>: validateAndAddDefaults(com.apple.timed): End Time (inf) > now (484012096.3) + BACKGROUND_TASK_AGENT_JOB_WINDOW_MAX_TIME_FROM_NOW_SEC (3024000.0) + BACKGROUND_TASK_AGENT_JOB_TIME_ERROR_MARGIN (300.0)
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 UserEventAgent[26] <Error>: validateAndAddDefaults(com.apple.timed): End Time (inf) > now (484012096.3) + BACKGROUND_TASK_AGENT_JOB_WINDOW_MAX_TIME_FROM_NOW_SEC (3024000.0) + BACKGROUND_TASK_AGENT_JOB_TIME_ERROR_MARGIN (300.0)
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 timed[778] <Notice>: (Error) CoreTime: Error requesting proactive time check job
info: [IOS_SYSLOG_ROW ] May 4 09:48:16 CarsGuide-iPhone-6 timed[778] <Notice>: (Error) CoreTime: Error requesting proactive time check job