Closed steven-joruk closed 4 years ago
I personally don't know how the waitFor methods are intended to be used.
My best guess is this something like this where you would need the app reference before the window appears https://github.com/daveenguyen/atomacos/blob/master/tests/test_wait_for_methods.py#L4
The waitFor method blocks while waiting for the event to occur. I think there would be a race condition if you are launching the app, grabbing the reference then waiting because the event might've already occurred before you started waiting.
At work we have a helper method to do something similar to this https://github.com/daveenguyen/atomacos/blob/master/tests/test_input.py#L50-L55
As for the error message, going to be honest I don't know why the error occurs.
They are pretty much from apple https://developer.apple.com/documentation/applicationservices/1462089-axobserveraddnotification
I've worked around it for now by polling with a timeout until the returned app reference and windows are valid.
I think the waitFor methods were also partially broken in the original atomac - at least I didn't see them return earlier than the specified timeout.
I expect I'll run in to the problem again soon for other test targets, and if so I'll try to fix the underlying issue.
Thanks 😄
Hey, I found your project yesterday after seeing how little maintainance atomac is receiving now, thanks for sharing your work
I can launch a bundle and get its app reference, but it isn't immediately usable because its UI may not have been set up yet.
I'd exect to be able to do this:
Or alternatively
app.waitForCreation()
But I see this error message for both:
I can work around it by just sleeping, but I expect to have hundreds of app launches in my testing and it'll add way too much time.