前言
pywinauto 查找窗口和控件时会有超时时间与轮询机制,可以通过timings 模块设置全局等待时间。
timings 模块
timings 模块有三个模式可以设置
- timings.Timings.fast() 快速模式
- timings.Timings.defaults() 默认模式
- timings.Timings.slow() 慢速模式
以下是可以调整的各个时序设置:
window_find_timeout (default 5)
window_find_retry (default .09)
app_start_timeout (default 10)
app_start_retry (default .90)
app_connect_timeout (default 5.)
app_connect_retry (default .1)
cpu_usage_interval (default .5)
cpu_usage_wait_timeout (default 20)
exists_timeout (default .5)
exists_retry (default .3)
after_click_wait (default .09)
after_clickinput_wait (default .09)
after_menu_wait (default .1)
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 2)
after_closeclick_wait (default .2)
after_windowclose_timeout (default 2)
after_windowclose_retry (default .5)
after_setfocus_wait (default .06)
setfocus_timeout (default 2)
setfocus_retry (default .1)
after_setcursorpos_wait (default .01)
sendmessagetimeout_timeout (default .01)
after_tabselect_wait (default .05)
after_listviewselect_wait (default .01)
after_listviewcheck_wait default(.001)
listviewitemcontrol_timeout default(1.5)
after_treeviewselect_wait default(.1)
after_toobarpressbutton_wait default(.01)
after_updownchange_wait default(.1)
after_movewindow_wait default(0)
after_buttoncheck_wait default(0)
after_comboboxselect_wait default(.001)
after_listboxselect_wait default(0)
after_listboxfocuschange_wait default(0)
after_editsetedittext_wait default(0)
after_editselect_wait default(.02)
drag_n_drop_move_mouse_wait default(.1)
before_drag_wait default(.2)
before_drop_wait default(.1)
after_drag_n_drop_wait default(.1)
scroll_step_wait default(.1)
设置模式
你想让操作更快一点,可以设置快速模式
from pywinauto.application import Application
from pywinauto.timings import Timings
Timings.fast()
你想让操作更慢一点,可以设置慢速模式
from pywinauto.application import Application
from pywinauto.timings import Timings
Timings.slow()
标签:17,windows,after,Timings,default,等待时间,timings,timeout,wait
From: https://www.cnblogs.com/yoyoketang/p/17658055.html