none
Powershell Version 2 Problem RRS feed

  • Question

  • i,m write a a powershell script to open a web page by internet explorer and check the web page to find a link on the webpage by span tag and click on link to open a link but $IE.Document.getElementsByTagName("span") | ? {$_.InnerHTML -eq "$word" not working in windows 7 powershell version 2 , script is :

    $IE = new-object -com internetexplorer.application
    $req = [System.Net.WebRequest]::Create("http://192.168.1.35/link.html")
    $resp = $req.GetResponse()
    $reqstream = $resp.GetResponseStream()
    $stream = new-object System.IO.StreamReader $reqstream
    $go = $stream.ReadToEnd() 
    $IE.navigate($go)
    $IE.visible=$true
    start-sleep 10
    $req = [System.Net.WebRequest]::Create("http://192.168.1.35/word.html")
    $resp = $req.GetResponse()
    $reqstream = $resp.GetResponseStream()
    $stream = new-object System.IO.StreamReader $reqstream
    $word = $stream.ReadToEnd()
    write-host $word
    $Link = $IE.Document.getElementsByTagName("span") | ? {$_.InnerHTML -eq "$word"}
    $Link.click()
    i want to replace any command to working this script with powershell version 2 in windows 7 and i don,t know what,s command can do that and find My mind link and click on that link with this script !
    • Moved by Bill_Stewart Thursday, January 3, 2019 3:52 PM Unanswerable drive-by question
    Friday, November 2, 2018 3:05 PM