Fetching OK and Failure Count from HTML Report using PowerShell

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Ron Ron 3 weeks, 5 days ago.

  • Author
    Posts
  • #57182
    Profile photo of Amar Helloween
    Amar Helloween
    Participant

    Hi All,

    I am having a HTML Report file. Raw file is here

    I need to extract the number(count) of OK and Failure . For example :

    Failure : 1
    OK : 43

    Kindly provide me with any solution or regex for this.

  • #57200
    Profile photo of Max Kozlov
    Max Kozlov
    Participant
    $c = gc D:\Downloads\Test.html
    [regex]::matches($c,'ok').Count
    [regex]::matches($c,'Failure').Count
    
  • #57206
    Profile photo of Ron
    Ron
    Participant

    Load the web page text in a variable, $html.

    ([regex]::matches($html, ">okfailure<", "IgnoreCase")).count

You must be logged in to reply to this topic.