Kinhow Posted July 2, 2015 Posted July 2, 2015 So I already have the DOM element in an object and what I am trying to do is getting the 173 out of this $tagElement<span class="health-count">173</span>I tried $tagElement.innnerHTML and innerText but it didnt work.Sorry if its a dumb question, but I have spent some time on this and could not find anything on the forum.
jvds Posted July 2, 2015 Posted July 2, 2015 maybe StringMid or _StringBetween?$string = '<span class="health-count">173</span>' $start=StringInStr($string,'<span class="health-count">')+StringLen('<span class="health-count">') $end=StringInStr($string,'</span>') $restul = StringMid($string,$start,$end-$start) ConsoleWrite('$restul='&$restul&@CRLF)or#include <String.au3> $test = _StringBetween($string,'<span class="health-count">','</span>',0) if IsArray($test) then ConsoleWrite('$test[0]='&$test[0]&@CRLF)
jguinch Posted July 2, 2015 Posted July 2, 2015 @Kinhow : show your code. There is probably and error with the $tagElement object.This works :#Include <IE.au3> $oIE = _IECreate() _IEBodyWriteHTML($oIE, '<span class="health-count">173</span>') $oSpans = _IETagNameGetCollection($oIE, "span") For $oSpan In $oSpans If $oSpan.className = "health-count" Then MsgBox(0, "", $oSpan.innerHtml & @CRLF) Next Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Kinhow Posted July 23, 2015 Author Posted July 23, 2015 For somehow innerText was not working, maybe a typo. But now its working fine! $tag.innerText
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