刷卡方法不工作的机器人自动化测试 [英] Swipe method not working in android automation testing

查看:229
本文介绍了刷卡方法不工作的机器人自动化测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现刷卡我method.May知道什么是达到我的目标,正确的方法是什么?

I am trying to implement swipe method.May I know what is the correct way to achieve my objective?

public void swipeWithCordinateLocation(WebDriver driver,double startX,
                                       double  startY,double endX,double endY,
                                       double Duration)
{
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, Double> swipeObject = new HashMap<String, Double>();
swipeObject.put("x", startX);
swipeObject.put("y", startY);
swipeObject.put("x", endX);
swipeObject.put("y",endY );
swipeObject.put("duration", Duration);
// HashMap[] param = {swipeObject};
js.executeScript("mobile: swipe", swipeObject);

}

common.swipeWithCordinateLocation(driver, 100.00, 500.00, 500.00, 500.00, 1.00);

但appium是进行刷卡,但它需要不同的凭据

But appium is perform swipe but it takes different credentials

[x=360][y=592]
 to [x=360][y=592]

。该怎么办? 任何一个可以帮我请。

. what to do? Can any one help me please.

推荐答案

分析轻扫自动化,最好的办法是让显示触摸,并在你的开发人员选项指针位置选项。

The best way to analyze a swipe in automation is to enable "Show touches" and "pointer location" options in your developer option.

正确的code的刷卡参数是这样的 -

The correct code for the swipe parameters is this -

swipeObject.put("startX", 198.00);
swipeObject.put("startY", 685.00);
swipeObject.put("endX", 198.00);
swipeObject.put("endY", 550.00);
swipeObject.put("duration", 1.0);

希望这有助于。

Hope this helps.

甚至是更好的方法是使用像使用部分 -

Or even a better way is to use something like using fractions -

swipeObject.put("startX", 0.50);
swipeObject.put("startY", 0.50);
swipeObject.put("endX", 0.50);
swipeObject.put("endY", 0.35);
swipeObject.put("duration", 1.0);

这篇关于刷卡方法不工作的机器人自动化测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆