selendroid 模式下可以正常运行,但是到滑动欢迎页面的时候,突然报错。
[INFO ] 2015-01-12 17:15:11 Login.toTestAnnouncementList() --> ============
[INFO ] 2015-01-12 17:15:14 Login.androidSwipe() --> #####Step0.1:define X, Y, duration
org.openqa.selenium.UnsupportedCommandException: Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47'
System info: host: 'wangjunbin', ip: '192.168.174.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Session ID: 38fbf146-065a-3b47-d720-a422a7b6d875
Driver info: boc.framework.appium.test.AppiumDriverTestCase$AppiumSwipeableWebDriver
Capabilities [{automationName=selendroid, platform=ANDROID, app=F:/Test/Eclipse/Android4EZDB/src/main/resources/Apps/EZDBpro.apk, acceptSslCerts=true, javascriptEnabled=true, browserName=selendroid, appActivity=com.boc.directbank.welcome.WelcomeActivity, networkConnectionEnabled=true, rotatable=true, desired={platformVersion=4.4.2, app=F:/Test/Eclipse/Android4EZDB/src/main/resources/Apps/EZDBpro.apk, platformName=Android, deviceName=Android Emulator, appActivity=com.boc.directbank.welcome.WelcomeActivity, device=Android, appPackage=com.boc.directbank}, appPackage=com.boc.directbank, version=0.12.0, platformVersion=16, platformName=android, deviceName=Android Emulator, handlesAlerts=true, device=Android, warnings={}, takesScreenshot=true}]
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 io.appium.java_client.AppiumDriver.performTouchAction(AppiumDriver.java:273)
at io.appium.java_client.TouchAction.perform(TouchAction.java:253)
at io.appium.java_client.AppiumDriver.swipe(AppiumDriver.java:338)
at script.touch.util.login.CommonFunc.androidSwipe(CommonFunc.java:43)
at script.touch.util.login.Login.toHomePage(Login.java:78)
at test.boc.field.announcementList.testAnnouncementList.toTestAnnouncementList(testAnnouncementList.java:49)
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.invokeMethod(Invoker.java:714)
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)
关于这段的源代码
public static AppiumDriver androidSwipe(AppiumDriver driver) throws Exception {
logger.info("#####Step0.1:define X, Y, duration ");
Sleeper.sleep();
int xStart = 600;
int yStart = 200;
int xEnd = 20;
int yEnd = 200;
int duration = 1000;
driver.swipe(xStart, yStart, xEnd, yEnd, duration);
return driver;
}
把这段给注释掉后,居然不识别 app 的所有的元素。(appium 模式下可以识别,定位。)
[INFO ] 2015-01-12 17:28:02 Login.toTestAnnouncementList() --> ============
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.24 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47'
System info: host: 'wangjunbin', ip: '192.168.174.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Session ID: e5a2b759-e718-bc38-28e3-a52a97cf7fa4
Driver info: boc.framework.appium.test.AppiumDriverTestCase$AppiumSwipeableWebDriver
Capabilities [{automationName=selendroid, platform=ANDROID, app=F:/Test/Eclipse/Android4EZDB/src/main/resources/Apps/EZDBpro.apk, acceptSslCerts=true, javascriptEnabled=true, browserName=selendroid, appActivity=com.boc.directbank.welcome.WelcomeActivity, networkConnectionEnabled=true, rotatable=true, desired={platformVersion=4.4.2, app=F:/Test/Eclipse/Android4EZDB/src/main/resources/Apps/EZDBpro.apk, platformName=Android, deviceName=Android Emulator, appActivity=com.boc.directbank.welcome.WelcomeActivity, device=Android, appPackage=com.boc.directbank}, appPackage=com.boc.directbank, version=0.12.0, platformVersion=16, platformName=android, deviceName=Android Emulator, handlesAlerts=true, device=Android, warnings={}, takesScreenshot=true}]
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.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByClassName(RemoteWebDriver.java:433)
at script.touch.util.login.Login.toHomePage(Login.java:82)
at test.boc.field.announcementList.testAnnouncementList.toTestAnnouncementList(testAnnouncementList.java:49)
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.invokeMethod(Invoker.java:714)
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)