I'm trying to write a test for a graphical component in Dyalog APL which will simulate button clicks which open new windows and keystrokes for filling in form fields. My first approach was to simply write a sequence of ⎕NQ statements for enqueuing events:
⎕NQ '#.foo.barButton' 'Select' ⍝ open window
⎕NQ '#.foo.bar.bazTab' 'Select' ⍝ select tab in opened window
....
The problem, however, is that ⎕NQ fails if the target object has not yet been displayed (for instance when opening a window):
VALUE ERROR: The event contains an invalid object or event name
I tried inserting a pause of a few seconds between the ⎕NQ statements but that didn't make any difference as the execution is synchronous.
What approach should I take?