开发者

Java Framework for automation based on Pixel Pattern recoginition

开发者 https://www.devze.com 2023-04-06 22:39 出处:网络
I have to develop some kind of bot for a testing background with Java. We used Selenium for all the web stuff, and outside the browser: Pixel recognition; that is, taking a screenshot, then compare it

I have to develop some kind of bot for a testing background with Java. We used Selenium for all the web stuff, and outside the browser: Pixel recognition; that is, taking a screenshot, then compare it with a image I hav开发者_如何学编程e already, and get the coordinates of where that pattern is on the screenshot.

Any Framework or free Java libraries that could make this job easier?

Thanks in advance!


You could probably get the following to work:

  • Use java.awt.Robot to take a screen capture as a BufferedImage
  • Convert the BufferedImage to a byte array
  • Do a standard string matching search to locate the pattern in the byte array. Even a naive string search (i.e. checking for the pattern at every possible location) could well be fast enough.
  • Convert the position in the byte array back to image co-ordinates


You could read this simple example.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号