如何使用pyWinAuto在TDBNavigator中访问按钮?
当id调用方法print_control_identifiers时,我无法在DBNavigator中找到按钮。 这是我的代码:
import time
try:
from pywinauto import application
except ImportError:
import os.path
pywinauto_path = os.path.abspath(__file__)
pywinauto_path = os.path.split(os.path.split(pywinauto_path)[0])[0]
import sys
sys.path.append(pywinauto_path)
from pywinauto import application
from pywinauto import tests
from pywinauto.findbestmatch import MatchError
from pywinauto import findwindows
from pywinauto import WindowAmbiguousError
from pywinauto.controls import WrapHandle
from pywinauto.timings import Timings
Timings.Fast()
app = application.Application()
app.connect_(path = "D:\SharedProjects\Projects\pyWinAuto\PYWINAUTO.exe")
pwin = app.MAIN
pwin.MenuSelect("Transaksi->Form 2")
frmDua = app['Form Dua']
frmDua.print_control_identifiers()
dbNavigator = frmDua['TDBNavigator']
dbNavigator.print_control_identifiers()
dbNavigator.print_control_identifiers()的结果是:
Control Identifiers:
TDBNavigator - '' (L673, T285, R1335, B310)
'3' 'TDBNavigator'
TDBNavigator中没有按钮。那么,我如何访问btnFirst,btnPrev,btnInsert等
答案 0 :(得分:0)
是的,最终我找到了它
dbNavigator = frmDua['TDBNavigator']
dbNavigator.SetFocus()
SendKeys.SendKeys("""{LEFT 10}""") #Move Cursor To Most LeftButton
SendKeys.SendKeys("""{RIGHT 4}""") #Move Cursor To InsertButton
SendKeys.SendKeys("""{SPACE}""") #Perform Click On Insert Button