我已经在VB中完成了表格。例如,单击提交按钮后出现警报框,我想读取警报框中的静态内容。这是我的代码:
import sys
import json
from pywinauto.application import Application
print("test")
app = Application(backend="uia").start("")
data=json.loads(sys.argv[1])
text=[]
for rec in data:
app.Form1.Edit6.type_keys(rec['name'])
app.Form1.Edit5.type_keys(rec['age'])
if rec['gender']=="male":
app.Form1.Male.click()
elif rec['gender']=="female":
app.Form1.Female.click()
app.Form1.Edit3.type_keys(rec['phnum'])
app.Form1.Submit.click_input()
app.Form1.Success.wait('visible', timeout=20)
text=app.Form1.Success.Static.WindowText()
app.Form1.Success.OKButton.click_input()
print("Records Submitted for ",rec['name'])
print('\n')
app.Form1.close()
print text
sys.stdout.flush()
答案 0 :(得分:1)
使用了window_text()
而不是WindowText()