简体   繁体   English

使用Java检测程序GUI

[英]Detect program GUI using Java

Is there any Java code can help to detect another program GUI part by part? 是否有任何Java代码可以帮助部分检测另一个程序GUI? For example, detect the size of the GUI, detect the location of the button. 例如,检测GUI的大小,检测按钮的位置。

Selenium does something similar to this but it is really not there. 硒的作用与此相似,但实际上不存在。 It will work only for browser-based apps/programs/sites. 它仅适用于基于浏览器的应用程序/程序/站点。 But if your target programs are browser-based, it will probably be a great tool. 但是,如果目标程序是基于浏览器的,则它可能是一个很好的工具。

For desktop programs, you might give a look to the createScreenCapture(Rectangle) method from the java.awt.Robot class to get a BufferedImage with the contents of the screen, and then it is up to you to try to make sense of the image, which would not be easy. 对于桌面程序,您可以从java.awt.Robot类中查看createScreenCapture(Rectangle)方法,以获取包含屏幕内容的BufferedImage ,然后由您自己来尝试理解图像,这并不容易。 Also, you might use the Robot to try to juggle out windows as needed, press buttons, type text, or whatever is needed to find out what you want. 此外,您可能会使用Robot尝试根据需要摆弄窗口,按按钮,键入文本或发现所需内容的任何方法。 All of this will be a lot of work. 所有这些都将是很多工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM