PowerShell - Internet Explorerの操作
Internet Explorerを起動して、Googleで"PowerShell"を検索してみる。
ただ、起動したIEのウィンドウを最前面にもってくる方法がわからない。
$keyword = "PowerShell" $ie = New-Object -ComObject InternetExplorer.Application $ie.Visible = $true $ie.Navigate('http://www.google.co.jp/') while($ie.Busy) { Start-Sleep -milliseconds 100 } $doc = $ie.document $search = $doc.getElementById("lst-ib") # 検索欄にキーワードを入力 $search.setAttribute("value",$keyword) $search.click() # 候補からキーワードを確定? $frm = $doc.getElementById("tsf") $frm.submit() $ie = $null $doc = $null $search = $null $frm = $null