1

javascript リンクから新しい IE ウィンドウを開く powershell スクリプトを作成しようとしています。その新しいウィンドウからテキストを読みたいと思います。これまでのところ、スクリプトは元の IE ウィンドウからコンテンツを読み取るだけであり、スクリプトが新しい IE ページからコンテンツを読み取る方法がわかりません。

    $ie = new-object -com InternetExplorer.Application 

    $ie.navigate("https://www.testsite.com/") 

    do {sleep 1} until (-not ($ie.Busy)) 

    $ie.visible = $true  

    $doc = $ie.document

    if ($ie.document.documentelement.innerText.Contains('Welcome') -eq "True") {
        "Site is RUNNING"
    } else {
        "Site is STOPPED"   
    }

    $link = @($ie.Document.getElementsByTagName('A')) | Where-Object {$_.innerText -eq 'Click here for new site'}

    $link.click()

    if ($ie.document.documentelement.innerText.Contains('New Page') -eq "True") {
        "Site is RUNNING"
    } else {
        "Site is STOPPED"   
    }

$link.click() の後に新しいウィンドウがポップアップし、新しいウィンドウから何かを読み取る方法がわかりません。元の www.test.com/ ページのテキストは読めましたが、新しいページのテキストは読めませんでした。

ありがとうございました。

PT

4

1 に答える 1