Automation scripts: is it possible to find specific text on the screen?

I create automated scripts using T-Plan Robot, a Java-based tool that is part of the SUT system.

I am currently processing where the mouse cursor should click, using mini-screenshots of locations using the waittomatch or compareto methods.

Example:

compareTo(new File[] { new File("C:\\Users\\User\\Google Drive\\Testing\\Automation\\Robot\\ImageTemplates\\LabelFirstName.png") }, "search2"); if (getContext().getExitCode() > 0) { exit(1); } else { mouseClick(new Point(getVariableAsInt("_COMPARETO_CLICK_X"), getVariableAsInt("_COMPARETO_CLICK_Y"))); } 

However, all these coincidences are the elements that I expect. Field labels do not change often and remain unchanged, so the script always finds them.

The problem that I am currently facing is the desire to find a specific record of the applicant on the screen after saving it. It has a constantly changing name, and not a fixed one, so this is not a simple example of taking a screenshot and its correspondence. For example, it adds the date and time to the end:

 type("PrimaryApplicant_" + getVariableAsString("_CURDATE"), "100"); 

Is there a way to move the mouse cursor over this exact text?

Maybe a way to save this information as a string, and then compare it with what is on the screen at that time? How it's done?

Hope this makes sense. Pretty hard to explain without demonstrating this!

thanks

+4
source share
1 answer

If the tag id is always “PrimaryApplicant_ddmmyyyy”, should you grab the tag with some regular expression that just ignores the date if I don't understand the problem? (I would make this comment, not the answer, but I don't think I have enough reputation ...)

0
source

Source: https://habr.com/ru/post/1446446/


All Articles