Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 刷卡在Appium Android Webview中不起作用_Java_Android_Selenium_Webview_Appium - Fatal编程技术网

Java 刷卡在Appium Android Webview中不起作用

Java 刷卡在Appium Android Webview中不起作用,java,android,selenium,webview,appium,Java,Android,Selenium,Webview,Appium,我正在使用下面的代码在web视图上滑动 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); dr

我正在使用下面的代码在web视图上滑动

 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
关于eclipsetestng

 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);

很抱歉迟了答复。我已尝试使用您提供的代码。现在我在appium服务器或TestNG上没有收到任何错误。我的方法通过了。但无法看到元素正在被刷。请帮忙。下面是代码TouchAction act=新的TouchAction(驱动程序);朗普斯特法案(604762100)。移动到(117762)。释放()@Hashili你找到解决办法了吗?我也有类似的问题,谢谢。@是的,我尝试使用driver.swipe方法时很有效。使用x,y坐标和延迟。。。。。如果这对你不起作用。。。在这个滑动方法和tryYou可以参考这个问题之前,只需将上下文切换到本机应用程序,它有点类似于您的问题: