Closed swanitzek closed 7 years ago
Hi Stefan First, thanks for using the library. I have written a version of your tests above, and have duplicated the issue. Once I know what the issue is, I will push both the fix and the test project. Mark H
Hi,
I think I have a fix, and it is probably a documentation / example issue. We recently refactored so that the library could be called from a DLL, as well as directly. In that refactoring we seem to have moved something that automatically happened to something that had to be manually called. If you making sure that the UIAuto instance has been created, either by adding TUIAuto.CreateUIAuto;
in the setup mechanism, or in the Initialization of the unit (in this case the test), this loads the library, initializes COM and sets all of the underlying stuff in the library.
Let me know if this fixes your issue. I've pushed a more complete set of examples, and will change the documentation to reflect the necessary change
initialization
TUIAuto.CreateUIAuto; // Initialise the library
RegisterTest(TestIAutomationBase.Suite);
Thanks Mark
Thank you. Adding a call to TUIAuto.CreateUIAuto resolved the issue for me!
Great, I've pushed the improved examples and documentation, and added a DUnit test application that is the equivalent of you test above. I'll close the issue, thanks for reporting it,
I created a Delphi test-project (DUnit) and included the DelphiUIAutomation-library. As soon as I call TAutomationDesktop.GetDesktopWindow the test-application crashes because the UDelphiUIAutomation-library accesses the global variable rootElement which is nil.
My code:
The line where is crashes (DelphiUIAutomation.Desktop:158):
rootElement.FindAll(TreeScope_Children, condition.getCondition, collection);
Any suggestions? Is there something I am doing wrong or is there a known issue? The call to TAutomationApplication.LaunchOrAttach() works just fine and starts the application.