Appium MAC 上运行 iOS 的例子报错,org.openqa.selenium.SessionNotCreatedException: A new session could not be created

老毕 · 2014年02月17日 · 最后由 dabao 回复于 2014年02月18日 · 1481 次阅读

MAC 上运行 iOS 的例子报错,求解决

org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Error locating the app: ENOENT, stat '/Users/bixiaopeng/workspace/source-github/appium/sample-code/examples/java/junit/../../../apps/TestApp/build/Release-iphonesimulator/TestApp.app') (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 151 milliseconds
Build info: version: '2.39.0', revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16 13:18:38'
System info: host: 'bixiaopeng.local', ip: '10.70.16.205', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.1', java.version: '1.6.0_65'
Driver info: com.saucelabs.appium.SimpleTest$SwipeableWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at com.saucelabs.appium.SimpleTest$SwipeableWebDriver.(SimpleTest.java:303)
at com.saucelabs.appium.SimpleTest.setUp(SimpleTest.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

共收到 15 条回复 时间 点赞

没找到 /Users/bixiaopeng/workspace/source-github/appium/sample-code/examples/java/junit/../../../apps/TestApp/build/Release-iphonesimulator/TestApp.app

#1 楼 @lihuazhang 原来需要使用对应的 SDK build 一下,不能直接安装好以后直接运行,哎

#2 楼 @wirelessqa 我也发现了,必须在对应的项目下 build 一次,然后用生成的 app 进行测试才行

#3 楼 @oscar 你现在运行成功能了吗

#4 楼 @wirelessqa 成功了额 xcodebuild -sdk iphonesimulator

#5 楼 @oscar 为何我运行他们的例子总是出问题,你成功运行了吗?求指教

#6 楼 @wirelessqa 你先去.../appium-master/sample-code/apps/TestApp,build 一下,然后回生成一个 build 文件,然后开启 appium 服务,运行那个 simple.py 这个例子就可以了啊

#7 楼 @oscar oK 我试一下 python. 再请问是否需要 sudo appium,官方文档说最好不要 sudo,可如果 sudo 会没有权限的错误,要如何处理?

我没有用 sudo 啊,mac 命令行下直接 appium &能起来的吧

老毕 #10 · 2014年02月18日 Author

#9 楼 @oscar 我去,还是跟我的用户权限有关系,在我的 mac pro 上可以正常跑起来,在我的 iMAC 就跑不起来.... 我记得很久以前我就跑起来过的.... 明天得再研究一下

@wirelessqa 应该是你的路径问题的了,'/Users/bixiaopeng/workspace/source-github/appium/sample-code/examples/java/junit/../../../apps/TestApp/build/Release-iphonesimulator/TestApp.app' 注意 ../../../ 这。另外如果你跑 android 的,务必设置系统变量 ANDROID_HOME,否则也会抛类似的错

老毕 #13 · 2014年02月19日 Author

#12 楼 @jelver 是因为没有先 build

#13 楼 @wirelessqa 不会真的是老毕本人吧?最近你 blog 怎么不更新了?

老毕 #14 · 2015年04月13日 Author

#14 楼 @pighero001 是好久没更新博客了 近来太忙

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册