I have a Java application that I want to automate for testing. Unfortunately, the app window only registers as a SunAWTFrame, which means none of the controls are exposed to typical window analysis and automation tools.
My search has lead me to C# and utilising Java Access Bridge DLLS in a C# program to automate it.
Has anyone had any experience of this?
Oracle provides JavaAccessBridge (JAB) with some DLLS to help with this as I understand it after reading a few articles around the internet. There are some code examples but I'm really not groking it right now. By breaking it down, I think this is what needs to be achieved:
- Import / load / parse the JAB dlls
- Map functions in the JAB dll to methods / calls within my program
- Have the Java application to automate run (with JAB enabled) and get handle of it to my program
- Utilise the JAB functions to control the Java application
I don't know C# as well as I know Java, but that's not going to stop me.
If anyone can provide help, guidance, pointers or anything to get me started, that'd be truly awesome.
As of 2019 we have a great tool AccessBridgeExplorer created and open-sourced by google. It's a really good staring point that contains a
WindowsAccessBridgeInteropproject which encapsulates almost every JAB API into a class oriented, .NET friendly assembly.One notable thing,
AccessBridge.Initialize()must be called in WPF/WinForm UI thread or in your own messaging pump thread, otherwise some methods likeAccessBridge.EnumJvms()will always return false/empty.