如何使用python单击窗口的“下一步"按钮 [英] How to click a 'next' button of a window using python
问题描述
我使用下面的代码连接一个打开的窗口(类类型是 SunAwtFrame),确实我能够连接到它.但无法单击它的下一步按钮,我怀疑下一步"按钮可能位于该窗口的框架内.即使我使用swapy"工具,我也无法浏览控件,实际上并没有显示控件.那么,如果是这种情况,如何切换到框架并单击下一步"按钮.
I used the below code to connect a opened window(Class type is SunAwtFrame), indeed I able to connect to it. but unable to click next button of it, my doubt is that 'Next' button may reside inside the frame of that window. Even when I use 'swapy' tool, I am unable to navigate through the controls, indeed not showing the controls actually. So, how to switch to frame if it is that case and click the 'Next' button.
app2 = application.Application()
app2.connect(title_re = u'abc')
dialog = app2.abc
print dialog
next =dialog.Next
print next
next.Click()
当我运行上面的代码时,我得到了这样的错误,请帮我解决这个问题
When I ran the above code I got the error like, Please help me to over come over this
#Error#:-
<pywinauto.application.WindowSpecification object at 0x025F26F0>
<pywinauto.application.WindowSpecification object at 0x025FA3B0>
next.Click()
File "C:\Python27\lib\site-packages\pywinauto\application.py", line 229, in __getattr__
ctrls = _resolve_control(self.criteria)
File "C:\Python27\lib\site-packages\pywinauto\application.py", line 788, in _resolve_contro
l
raise e.original_exception
pywinauto.findwindows.WindowNotFoundError
推荐答案
您似乎一直在尝试通过 pywinauto 自动化非标准控件.我建议你按坐标点击,当然如果除了按下按钮没有其他任务.
It seems like you have been trying automate non standard controls by pywinauto. I am recommending you make a click by coordinates, of course if there are no other tasks except press the button.
dialog.Click(coords=(x, y))
dialog.Click(coords=(x, y))
或
dialog.ClickInput(coords=(x, y))
dialog.ClickInput(coords=(x, y))
这篇关于如何使用python单击窗口的“下一步"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!