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 方法,传入相同的值,倒是可以运行成功。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值