Search Internet Explorer Object

Welcome Forums General PowerShell Q&A Search Internet Explorer Object

This topic contains 1 reply, has 2 voices, and was last updated by

4 years, 11 months ago.

  • Author
  • #14277

    Points: 0
    Rank: Member

    I am new to powershell, and am trying to write a script that opens Internet Explorer, navigates to a page, then searches that page for a string of text. Here is the beginning of my code, I just can't seem to figure out how to search the hidden page once it opens for a string of text, such as "EXAMPLE"

    $ie = New-Object -com InternetExplorer.Application
    while($ie.ReadyState -ne 4) {start-sleep -m 100}

    Any help would be greatly appreciated.

  • #14279

    Points: 0
    Rank: Member

    Are you fixed on using Internet Explorer for this? You'd have an easier time using Invoke-WebRequest, in PowerShell. For example:

    $response = Invoke-WebRequest -Uri ''

    $response will be a [Microsoft.PowerShell.Commands.HtmlWebResponseObject] object which has lots of useful properties. $response.Content will give you the page's raw HTML code. The AllElements, Forms, Headers, Images, InputFields and Links properties give you access to information about the HTML tags found on the page.

    $response.ParsedHtml will be a reference to a COM object that lets you access the HTML DOM model directly (though I'll warn you, this is very slow in PowerShell for some reason. Use the other properties if they'll get the job done for you.) For instance, you could execute $response.ParsedHtml.documentElement.getElementsByTagName('table')

The topic ‘Search Internet Explorer Object’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort