Hello everyone!
That i want to do is to “click”/“touch” on a android screen through images because i want to test a game and this game don’t have any xpath.
If i cant use image recognition then I at least want to “click” on the screen using coordinates.
But none of these options have worked for me so far.
This far has i come. Now i using Appium Driver.
USING IMAGE RECOGNITION ON DESKTOP
public void playGame() throws InterruptedException, FindFailed {
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));
}
}
This image recognition is working fine on desktop. My goal is to do this but on android! But the click method don´t work on android, only desktop. I have heard that you can use tap, performTouchAction and press instead but i don´t know how to use them.
USING PRESS ON ANDROID:
TouchAction action = new TouchAction(driver);
action.press(10, 0).moveTo(22,33).release().perform();
The problem here is that i don´t know how to get the RIGHT coordinates for android.
Have anyone tried to test automate mobile games/or something similar on android or used image recognition on android or used coordinates on android? Or have you used a different tactic to test automate on android or an other device?
Thanks in advance!