android uiautomation多点触控变量?

时间:2019-03-15 07:23:41

标签: android uiautomator

我试图在uiautomation测试中测试多点触控功能,所以我在Internet上搜索并找到了一种逐步编码的方法:

UiDevice mDevice = Uidevice.getInstance(InstrumentationRegistry.getInstrumentation());

UiObject frame = mDevice.findObject(new UiSelector().className(View.class));

  PointerCoords p = new PointerCoords();
  p.x = 500;
  p.y= 500;
  p.pressure = 1;
  p.size = 1;

  PointerCoords p1 = new PointerCoords();
  p1.x = 600;
  p1.y= 600;
  p1.pressure = 1;
  p1.size = 1;

  PointerCoords p2 = new PointerCoords();
  p2.x = 500;
  p2.y=500;
  p2.pressure = 1;
  p2.size = 1;

  frame.performMultiPointerGesture(p,p1,p2);

但由于此行frame.performMultiPointerGesture(p,p1,p2)

而出错

这是错误:

performMultiPointerGesture() in UiObject cannot be applied to:
Expected Parameters:
touches:
android...MotionEvent.PointerCoords[]...

Actual Arguments:
p  (android.view.MotionEvent.PointerCoords)

p1  (android.view.MotionEvent.PointerCoords)

p2  (android.view.MotionEvent.PointerCoords)

我不知道应该在()中键入什么,因为我在互联网上搜索的这段代码似乎并没有错,所以我很困惑,请帮忙。

0 个答案:

没有答案