NetUIHWND issues - Saving an Excel worbook
I have a test, for a Delphi application, that invokes Excel in order to save a report created in the application.
Excel is closed and then the workbook should be saved, with a prescribed title, to a location on the hard drive.
Everything is fine up to the point of trying to Save. The script, in the test, closes the workbook at which point the MS Excel window (WndClass: NUIDialog with child window WndClass: NetUIHWND) appears offering the User the options of three buttons 'Save', 'Don't Save' & 'Cancel'. Herein lies the issue; TestComplete (Version 12.0.122.7 on WIN10, MS Excel2013) is unable to see any of the properties of that child window NetUIHWND. Not the caption (WndCaption) "Want to Save your changes to 'Book1' or the afore mentioned three buttons.
The result of this is that my test (automated) fails when trying to click the 'Save' button as it cannot be found.
I have tried running a script recording but all this does is reinforce the issue that TestComplete cannot read beyond the WndClass property of the child window as it records the click on the 'Save' button merely as a set of coordinates - which is of no use as it cannot be certain that the window will appear in exactly the same location every time.
Anyone else had the same issue and, if so, how did you get around it?
Cheers,
Steve.
Have you tried to use the buttons shortcuts ?
Something like this:
Sys.Process('excel').Window('NUIDialog', 'Microsoft Excel', 1).Window('NetUIHWND', '', 1).SetFocus
Sys.Desktop.Keys('~S')
This will enters 'ALT + S' (Save) into the control with focus. Or just the second line if the window is already focused.