Appium 新人求助:Android4.1 手机跑 testng 老是提示 API<17,用 selendroid 模式也会出现错误

wuming · 2014年11月27日 · 最后由 Jianjie.Xu 回复于 2014年11月27日 · 1242 次阅读

用 MX3 非原生系统,设置成 4.3,APPium,可以正常跑。
用华为原生系统 4.2,设置成 4.2,APPium,可以正常跑。
为什么用 4.1 的手机设置 4.1,selendroid 就没办法跑了。
粉嫩嫩的新人真心求助。
是否需要在哪个地方添加脚本。。。
能否全贴出来。。。
谢谢。。。

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 13 条回复 时间 点赞

问的太简单了。 不能跑,你至少要把日志贴出来。

A new session could not be created. (Original error: Command failed: can't find 'C:\Windows\Temp\selendroid.com.ss.boc.direct.abc.activity.apk' to install
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 13.87 seconds
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47'
System info: host: 'wjj', ip: '172.27.35.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Driver info: boc.framework.appium.test.AppiumDriverTestCase$AppiumSwipeableWebDriver
    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:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:95)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:49)
    at boc.framework.appium.test.AppiumDriverTestCase$AppiumSwipeableWebDriver.<init>(AppiumDriverTestCase.java:211)
    at boc.framework.appium.test.AppiumDriverTestCase.StartDriver(AppiumDriverTestCase.java:96)
    at boc.framework.appium.test.AppiumDriverTestCase.setUp(AppiumDriverTestCase.java:52)
    at test.boc.smoke.bankCard.testBankCard.setUp(testBankCard.java:33)
    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:84)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

@lihuazhang ,上面是日志,请查看下。

小弟不说完全看不懂,只能说基本上看不懂。

(Original error: Command failed: can't find 'C:\Windows\Temp\selendroid.com.ss.boc.direct.abc.activity.apk' to install 找不到啊。

@lihuazhang 这个是啥子意思,是要 install 一个 activity.apk 吗,谢谢。。。

大婶们,人呢,人都哪去了

@lihuazhang,这个路径下能找到 selendroid.com.ss.boc.direct.abc.activity.apk'

C:\Windows\Temp\selendroid.com.ss.boc.direct.abc.activity.apk 确定能找到?

wuming #10 · 2014年11月27日 Author

确定一定以及肯定

我不是这个意思 我是说你代码里面这样写路径能不能找到。 你的代码问题。。

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.1'
desired_caps['deviceName'] = 'Huawei G610'
desired_caps['app'] = CommonLib.app
desired_caps['automationName'] = 'selendroid'
desired_caps['appWaitActivity'] = 'replace your first activity name'
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', 
                                  desired_caps)

selendroid 是这样,你再检查一下手机的应用中 selendroid 有没有安装上

wuming #13 · 2014年11月28日 Author

我再试试看啊。。。非常感谢两位。

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