首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >测试自动化-无法在android屏幕上测试游戏

测试自动化-无法在android屏幕上测试游戏
EN

Stack Overflow用户
提问于 2017-11-10 21:21:14
回答 1查看 190关注 0票数 0

我想要做的是通过图像在android屏幕上“点击”/“触摸”,因为我想测试一个游戏,而这个游戏没有任何xpath。如果我不能使用图像识别,那么我至少希望使用坐标在屏幕上“点击”。

但到目前为止,这些选择对我来说都不起作用。我已经走了这么远。现在我使用的是Appium驱动。

在桌面上使用图像识别:

公共空playGame()抛出InterruptedException,FindFailed {

代码语言:javascript
复制
    Screen screen = new Screen();
    String imageLibrary = "src/main/resources/automated-tests/images/";
    String skipIntro = imageLibrary + "JackAndTheBeanstalk/skip.PNG";
    String skipInfo = imageLibrary + "JackAndTheBeanstalk/continue.PNG";
    String bet = imageLibrary + "JackAndTheBeanstalk/increaseStakes.PNG";
    String play = imageLibrary + "JackAndTheBeanstalk/play.PNG";
    Thread.sleep(10000);

    if (screen.exists(new Pattern(skipIntro).similar((float) 0.8)) != null) {
        System.out.println("Start playing Jack and the beanstalk");
        Thread.sleep(10000);
        screen.click(new Pattern(skipIntro).similar((float) 0.8));
        screen.click(new Pattern(skipIntro).similar((float) 0.8));
        screen.click(new Pattern(skipInfo).similar((float) 0.8));
        screen.click(new Pattern(bet).similar((float) 0.8));
        screen.click(new Pattern(play).similar((float)0.8));
    }
}

这种图像识别在桌面上运行良好。我的目标是在android上做到这一点!但点击方法在android上不起作用,只能在桌面上起作用。我听说你可以用tap,performTouchAction和press来代替,但我不知道如何使用它们。

在ANDROID上使用PRESS:

TouchAction TouchAction=新驱动程序;action.press(10,0).moveTo(22,33).release().perform();

这里的问题是,我不知道如何为android获得正确的坐标。

有没有人尝试过在android上测试自动化手机游戏/或类似的东西,或者在android上使用图像识别,或者在android上使用坐标?或者,您是否使用了不同的策略在android或其他设备上测试automate?

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2017-11-11 00:43:55

目前还不清楚你正在使用什么库来进行图像识别(你要导入什么来使用Screen类?)。

但很明显,只有Appium是不足以测试它的。

您可以研究Appium + Sikuli APIAppium+OpenCV原型。

到目前为止有几个链接:

Appium+Sikuli

Appium+OpenCV+Akaze

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47223751

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档