我是靠谱客的博主 迷路鸵鸟,最近开发中收集的这篇文章主要介绍android 脚本swipe,appium1.1 版本使用 swipe 方法报错,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

环境配置: appium1.1,windows 7,HTC one

public void setUp() throws Exception {

//配置 webdriver

DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability(CapabilityType.BROWSER_NAME, "");

capabilities.setCapability("platformName", "Android");

capabilities.setCapability("platform", "WINDOWS");

capabilities.setCapability("deviceName","HTC");

capabilities.setCapability("platformVersion", "4.2");

capabilities.setCapability("appPackage", "com.taobao.taobao");

capabilities.setCapability("appActivity", "com.taobao.tao.homepage.MainActivity3");

//appium 的独特地方,使用自己的 AppiumDriver, 它本身是继承自 WebDriver

driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

//设置超时

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

}

@After

public void tearDown() throws Exception {

driver.quit();

}

@Test

driver.swipe(157, 1029, 156, 1, 1);

takeScreenShot(driver);

appium 运行日志:

ERROR: debug: Appium request initiated at /wd/hub/session/616bac0b-bc9c-46e5-bfa9-bd1f2e3cca8f/touch/perform

info: Pushing command to appium work queue: ["swipe",{"startX":157,"startY":1029,"endX":156,"endY":1,"steps":0}]

ERROR: debug: Request received with params: {"actions":[{"action":"press","options":{"y":1029,"x":157}},{"action":"wait","options":{"ms":1}},{"action":"moveTo","options":{"y":1,"x":156}},{"action":"release","options":{}}]}

info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"swipe","params":{"startX":157,"startY":1029,"endX":156,"endY":1,"steps":0}}

info: [BOOTSTRAP] [info] Got command of type ACTION

info: [BOOTSTRAP] [debug] Got command action: swipe

info: [BOOTSTRAP] [info] Swiping from [x=157.0, y=1029.0] to [x=156.0, y=1.0] with steps: 0

info: [BOOTSTRAP] [info] Returning result: {"value":"The swipe did not complete successfully","status":13}

info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"The swipe did not complete successfully"},"sessionId":"616bac0b-bc9c-46e5-bfa9-bd1f2e3cca8f"}

PS:使用 js.executeScript 方法,传入相同的值,倒是可以运行成功。

有小伙伴遇到同样的问题吗?请问怎么解决的,谢谢。

最后

以上就是迷路鸵鸟为你收集整理的android 脚本swipe,appium1.1 版本使用 swipe 方法报错的全部内容,希望文章能够帮你解决android 脚本swipe,appium1.1 版本使用 swipe 方法报错所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部