繁体   English   中英

滑动不适用于Appium Android Webview

[英]Swipe is not working in Appium Android Webview

我正在使用以下代码在网络视图上滑动

 driver.findElement(By.xpath("//*[@id=\"mainSec\"]/section/div[2]/div/div[2]/div/input[1]")).sendKeys(username);

 driver.findElement(By.xpath("//*[@id=\"mainSec\"]/section/div[2]/div/div[2]/div/input[2]")).sendKeys(password);
 driver.findElement(By.xpath("//*[@id=\"mainSec\"]/section/div[2]/div/div[3]/button")).click();
 Thread.sleep(20000);
 driver.swipe(944, 1100, 110, 1100, 2000);

低于错误

在Appium服务器上

> info: --> POST /wd/hub/session/71ff38f1-3e77-44ef-b4af-d2ab69970112                        
 /touch/perform {"actions":[{"action":"press","options": {"x":944,"y":1100}},{"action":"wait","options":{"ms":2000}},{"action":"moveTo","options":{"x":110,"y":1100}},{"action":"release","options":{}}]}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/71ff38f1-3e77-44ef-b4af-d2ab69970112/touch/perform] to [POST http://127.0.0.1:9515/wd/hub/session/9effe9253998eaad03f14d1cc5ef148c/touch/perform] with body: {"actions":[{"action":"press","options":{"x":944,"y":1100}},{"action":"wait","options":{"ms":2000}},{"action":"moveTo","options":{"x":110,"y":1100}},{"action":"release","options":{}}]}
> info: JSONWP Proxy: Got response with status 404: unknown command: session/9effe9253998eaad03f14d1cc5ef148c/touch/perform

在Eclipse TestNG上

 org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
 Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
 System info: host: 'IN2084073W1', ip: '10.165.162.203', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
 Driver info: driver.version: AppiumDriver

使用TouchAction类执行滑动。 像这样:

TouchAction action = new TouchAction(driver).longPress(longPress).moveTo(moveTo).release();
action.perform();

也许您可以将上下文切换到本地,例如

driver.context("NATIVE_APP");

然后,滑动即可

driver.swipe(500, 1600, 500, 600, 1000);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM