我尝试过:
Add-Type -AssemblyName UIAutomationClient
$chromes = Get-Process -Name chrome
foreach ($chrome in $chromes) {
if ($chrome.MainWindowHandle -eq [System.IntPtr]::Zero) {
continue
} else {
$chrome.MainWindowHandle
}
$element = [System.Windows.Automation.AutomationElement]::FromHandle($chrome.MainWindowHandle)
$condition = [System.Windows.Automation.PropertyCondition]::New([System.Windows.Automation.AutomationElement]::ClassNameProperty, "Chrome_OmniboxView")
$edit = $element.FindFirst([System.Windows.Automation.TreeScope]::Subtree, $condition)
$edit
}
$edit
是$null
。
日本的Chrome版本75。