【问题标题】:How to wait for button in uia automation using powershell如何使用powershell等待uia自动化中的按钮
【发布时间】:2019-05-09 16:40:44
【问题描述】:

目前我想等待查看是否在窗口中启用了按钮,我可以看到 uiautomation.dll 支持许多等待命令行开关。但无法使其在窗口内工作。我正在尝试的命令。

等待窗口的工作代码

Wait-UIAwindow -name "WindowMessageBox"

当我等待按钮时在窗口内不工作

Get-UIAwindow -name "WindowMessageBox" | Wait-uiabuttonisenabled -automationid "ButtonID" 

启用按钮后有什么帮助吗?

【问题讨论】:

    标签: powershell ui-automation


    【解决方案1】:
    Get-UiaButton -AutomationId '1001' -Class 'Button' -Name 'Browse...' | Wait-UiaButtonIsEnabled  -Seconds 3000| Invoke-UIAButtonClick
    

    这对我有用,Wait-uiabuttonisenabled 没有 -automationid 参数,所以必须在我的代码中处理它而不是 Invoke-UIAButtonClick 你可以放置 ( Get-UIAwindow -name "WindowMessageBox" )

    【讨论】:

    • 请编辑您的答案,以提高可读性。将代码标记为这样,并将新句子的第一个字符大写。
    猜你喜欢
    • 2013-06-08
    • 2012-06-22
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-03
    • 2021-12-07
    • 1970-01-01
    相关资源
    最近更新 更多