【发布时间】:2020-01-23 17:25:32
【问题描述】:
是否有人将“pywinauto/examples/uninstall_7zip.py”示例移植到 Windows 10?我试图运行它,但它失败了:
NewWindow.type_keys(r'Control Panel\Programs\Programs and Features{ENTER}', with_spaces=True,
set_foreground=False) (Fails in this line)
我修改后到达控制面板卸载窗口,进一步也无法获取/选择7-Zip程序。下面是到达卸载窗口的代码sn-p:
Application().start('control.exe')
app = Application(backend='uia').connect(path='explorer.exe', title='Control Panel')
# Go to "Programs"
app.window(title='Control Panel').ProgramsHyperlink.invoke()
app.wait_cpu_usage_lower(threshold=0.5, timeout=30, usage_interval=1.0)
# Go to "Uninstall a program"
app.window(title='Programs').child_window(title='Uninstall a program',
control_type='Hyperlink').invoke()
app.wait_cpu_usage_lower(threshold=0.5, timeout=30, usage_interval=1.0)
【问题讨论】:
-
请详细说明“不起作用”和“失败”。
-
如果您尝试在 Windows 10 上运行 7-zip 程序,它会因为以下原因而失败 -
-
因为什么原因?
-
以下代码失败并显示“没有与您的搜索匹配的项目”==> 尝试:NewWindow.AddressBandRoot.click_input() NewWindow.type_keys(r'Control Panel\Programs\Programs and Features{ENTER}', with_spaces=True, set_foreground=False)
-
@Joseph Sible-Reinstate Monica,我修改了代码,我可以进入卸载窗口,但是无法选择要卸载的程序,下面是修改后的程序-
标签: pywinauto