CaptainBeardsEyesBeard Posted February 7, 2020 Posted February 7, 2020 (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 February 7, 2020 by CaptainBeardsEyesBeard
Subz Posted February 7, 2020 Posted February 7, 2020 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.
CaptainBeardsEyesBeard Posted February 7, 2020 Author Posted February 7, 2020 (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 February 7, 2020 by CaptainBeardsEyesBeard
Subz Posted February 7, 2020 Posted February 7, 2020 That doesn't make sense since you don't even use the $h3Headers object in the loop.
Danp2 Posted February 7, 2020 Posted February 7, 2020 @Subz $h3Headers is used as the source collection of the For..In..Next loop. Latest Webdriver UDF Release Webdriver Wiki FAQs
Subz Posted February 7, 2020 Posted February 7, 2020 @Danp2 - @CaptainBeardsEyesBeard just edited the code it was $oButton in $oButtons which is why I was confused Danp2 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now