pyWinAuto: pywinauto.timings -- Timing settings for all of pywinauto

timings

Timing settings for all of pywinauto

This module has one object that should be used for all timing adjustments
timings.Timings

There are a couple of predefined settings

timings.Timings.Fast() timings.Timings.Defaults() timings.Timings.Slow()

The Following are the individual timing settings that can be adjusted:

  • window_find_timeout (default 3)
  • window_find_retry (default .09)
  • app_start_timeout (default 10)
  • app_start_retry (default .90)
  • exists_timeout (default .5)
  • exists_retry (default .3)
  • after_click_wait (default .09)
  • after_clickinput_wait (default .01)
  • after_menu_wait (default .05)
  • after_sendkeys_key_wait (default .01)
  • after_button_click_wait (default 0)
  • before_closeclick_wait (default .1)
  • closeclick_retry (default .05)
  • closeclick_dialog_close_wait (default .05)
  • after_closeclick_wait (default .2)
  • after_windowclose_timeout (default 2)
  • after_windowclose_retry (default .5)
  • after_setfocus_wait (default .06)
  • after_setcursorpos_wait (default .01)
  • sendmessagetimeout_timeout (default .001)
  • after_tabselect_wait (default .01)
  • after_listviewselect_wait (default .01)
  • after_listviewcheck_wait default(.001)
  • after_treeviewselect_wait default(.001)
  • after_toobarpressbutton_wait default(.01)
  • after_updownchange_wait default(.001)
  • after_movewindow_wait default(0)
  • after_buttoncheck_wait default(0)
  • after_comboselect_wait default(0)
  • after_listboxselect_wait default(0)
  • after_listboxfocuschange_wait default(0)
  • after_editsetedittext_wait default(0)
  • after_editselect_wait default(0)

Attributes

a Timings

<pywinauto.timings.TimeConfig object at 0x014D30F0>

Functions

f WaitUntil(timeout, retry_interval, func, value=True, op=<built-in function eq>) ...

Wait until op(function(*args), value) is True or until timeout
expires

  • timeout how long the function will try the function
  • retry_interval how long to wait between retries
  • func the function that will be executed
  • value the value to be compared against (defaults to True)
  • op the comparison function (defaults to equality) * args optional arguments to be passed to func when called

Returns the return value of the function If the operation times out then the return value of the the function is in the 'function_value' attribute of the raised exception.

e.g.

try:
   # wait a maximum of 10.5 seconds for the
   # the objects ItemCount() method to return 10
   # in increments of .5 of a second
   WaitUntil(10.5, .5, self.ItemCount, 10)
except TimeoutError, e:
   print "timed out"

f WaitUntilPasses(timeout, retry_interval, func, exceptions=<class exceptions.Exception at 0x00A74570>) ...

Wait until func(*args) does not raise one of the exceptions in
exceptions

  • timeout how long the function will try the function
  • retry_interval how long to wait between retries
  • func the function that will be executed
  • exceptions list of exceptions to test against (default: Exception)
  • args optional arguments to be passed to func when called

Returns the return value of the function If the operation times out then the original exception raised is in the 'original_exception' attribute of the raised exception.

e.g.

try:
   # wait a maximum of 10.5 seconds for the
   # window to be found in increments of .5 of a second.
   # P.int a message and re-raise the original exception if never found.
   WaitUntilPasses(10.5, .5, self.Exists, (WindowNotFoundError))
except TimeoutError, e:
   print "timed out"
   raise e.

Classes

C TimeConfig(...) ...

Central storage and minipulation of timing values

This class contains 4 members.

C TimeoutError(...) ...

This class contains 2 members.

See the source for more information.