我如何使用pywinauto对子窗口中存在的按钮执行点击操作?

问题描述 投票:1回答:1

我能够在父窗口上执行按钮单击,但不确定如何在子窗口的按钮上执行单击操作。

app = Application().connect(path=newPath) 
app.name_of_the_parent_window.draw_outline()
app.name_of_the_parent_window.print_control_identifiers()
app.name_of_the_parent_window.Button6.click()  #this click will open a new window with yes & no buttons.I would like to click on yes button but I am unable to do that

print(app.windows()[0].children(title_re=".*would you like to reset.*", class_name="Button")) #this prints the information about buttons

image of the result of the above print command

我可以看到“是”是一个按钮。但我不知道在按钮yes]上执行click()的方法

我尝试了以下命令,但失败,并显示错误消息error mesage image

请让我知道如何在子窗口的按钮上执行点击操作。

我能够在父窗口上执行按钮单击,但不确定如何在子窗口的按钮上执行单击操作。 app = Application()。connect(path = newPath)app ....

python-3.x button click pywinauto
1个回答
0
投票

它返回ButtonWrapper的列表。因此,您可以选择例如第一个按钮并为其调用方法.click()。该方法是静音的(鼠标光标不会移动),因此另一种方法.click_input()执行更逼真的单击。

© www.soinside.com 2019 - 2024. All rights reserved.