Jump to content

Recommended Posts

Posted (edited)

I am trying to access this HTML as I want to take the header and put it into a variable

<div class="col-lg-12">
        <h3>Your unique reference is TEST_303</h3>
    </div>

I have tried using this and have tried a few variations on it 

$tags = $oIE.document.GetElementsByTagName("div")
For $tag in $tags
    $class_value = $tag.GetAttribute("class")
    If $class_value = "col-lg-12" Then

      ConsoleWrite(@CRLF & "$class_value: " & $class_value)
      ConsoleWrite(@CRLF & "$class_value: " &  $class_value.innertext)
      ConsoleWrite(@CRLF & "$class_value: " & $class_value.value)


    EndIf
 Next

but my console output looks like this 

$class_value: col-lg-12
$class_value: 
$class_value: 
$class_value: col-lg-12
$class_value: 
$class_value: >Exit code: 0

 

Edited by CaptainBeardsEyesBeard
Posted

That's the problem with ClassNames they can be used multiple times through out a document, you'll need to find a unique identifier above the div and then you can use it to identify the child div.

Posted (edited)

I managed to solve it after repeat testing using the below 

 

$h3Headers= _IETagNameGetCollection($oIE, "h3")
For $h3Header In $h3Headers
   ;Use string in string as 2nd half of variable is a unique number 
    If StringInStr($h3Header.InnerText, "Your unique reference is")        Then
            if @Error then
            ConsoleWrite(@CRLF & "Error finding h3 header")

            Endif
        MsgBox(64, 'h3 Header Found', 'h3 header found  with value: ' & $h3Header.InnerText, 2)
        Sleep(2500)
        ConsoleWrite(@CRLF & "$class_value: " &  $h3Header.innertext)

        ExitLoop
        Sleep(4000)
    EndIf
 Next

 

Edited by CaptainBeardsEyesBeard

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...