daveenguyen / atomacos

Automated Testing on macOS
https://daveenguyen.github.io/atomacos/
GNU General Public License v2.0
48 stars 13 forks source link

Help with wait methods #9

Closed alekseijershov closed 4 years ago

alekseijershov commented 4 years ago

Hi!

 I trying to understand how methods which have wait functionality works For example, I’m trying to wait when system preferences windows is appears and every time timeout is work and return value is None Example:

os.system('open x-apple.systempreferences:com.apple.preference.security?General') main_window = atomacos.getAppRefByBundleId('com.apple.systempreferences') main_window.waitForWindowToAppear('System Preferences')

Regards, AJ

daveenguyen commented 4 years ago

I don't use wait methods myself, but my understanding is you call the waitFor and it will block until the event occurs.

Here's an example use case

  1. Finder is running and you have an AppRef to finder.
  2. Call waitForCreation method
  3. Some other code creates a new Finder window
  4. waitForCreation stops waiting and code execution continues

https://github.com/daveenguyen/atomacos/blob/master/tests/test_atomacos.py#L151