Search code examples
.netwinformsuser-interfacerpa

Accessing a .net application GUI


I need to access a .net application which has no public COM or API. Apparently the only means of access is Forms GUI.

Basically, I need to simulate users filling and submitting a form. Enter text here, something else there, and submit.

We have a "click at this position and simulate typing this text" kind of robot, but it doesn't handle new versions of the form well.

Is it possible to interact with such a GUI (or application?) in a programmatic way which doesn't rely on exact position of components? Ideally, something like: "Type bla-bla-bla into Address field and click the Submit button".


Solution

  • That is an interesting problem. While I haven't tried that approach myself I think it should be quite possible to write another application that will host the existing application.

    WinForms forms are just classes, fields and buttons are just classes, event (onClick etc) handlers are just methods, which you can all access and manipulate from your hosting application (you may need to resort to reflection to access some private members but that should not be a big deal).

    UPDATE

    Actually I think White might be a nice tool to aid you in this task. I never used it but the getting started sample code looks interesting.