powershell - 如何使用powershell等待uia自动化中的按钮
问题描述
目前我想等着看窗口中是否启用了按钮,我可以看到 uiautomation.dll 支持许多等待命令行开关。但无法使其在窗口内工作。我正在尝试的命令。
等待窗口的工作代码
Wait-UIAwindow -name "WindowMessageBox"
当我等待按钮时不在窗口内工作
Get-UIAwindow -name "WindowMessageBox" | Wait-uiabuttonisenabled -automationid "ButtonID"
启用按钮后获得结果有什么帮助吗?
解决方案
Get-UiaButton -AutomationId '1001' -Class 'Button' -Name 'Browse...' | Wait-UiaButtonIsEnabled -Seconds 3000| Invoke-UIAButtonClick
这对我有用,没有-automationid
参数,Wait-uiabuttonisenabled
所以必须在我的代码中使用流水线处理它,而不是 Invoke-UIAButtonClick
你可以放置( Get-UIAwindow -name "WindowMessageBox" )
推荐阅读
- qt - 使用 QAbstractProxyModel 将 QSqlTableModel 映射到 QTreeView 的问题
- visual-studio-code - 将“search.smartCase”从 true 更改为 false 或反之亦然时是否有明显效果
- excel - 如何使用 Excel VBA 将 pdf 转换为 xlsx
- ruby-on-rails - Rails has_many 通过 HABTM 关系
- python - 如果标题没有更改,如何在更新帖子时防止更改 slug 值?
- azure - 基于 Azure AD 会话的身份验证
- python - Django StaticLiveServerTestCase 以及压缩的超表
- julia - 如何在 Flux.jl 中初始化权重
- typescript - 将通用属性合并到类
- node.js - 使用 pdfkit 打印条形码