Sign in to follow this  
Followers 0
tommytx

How to getElementsByTagName?

2 posts in this topic

#1 ·  Posted (edited)

Wonder why there is no command "getElementsByTagName" as in javascript..It seems like that would be a very useful tool.

so I am trying to modify the next best command.. can someone help me..

Func dolinks_now()
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
if $oElement.tagname = "h1" then msgbox(0, "", $oElement.innerText)
; Msgbox(0, "", $oElement.tagname & ":" & $oElement.innerText & @CRLF)
Next
EndFunc

When I remove the ; from the msgbox.. that works fine but it gives all of the elements one by one..

What I want to do is extract just one set such as "H1" or "li" you get the idea.. I tried using the If statement but it fails..

Can someone point me to the correct command...

And then once I get all the "H1" if there is more than one can I pick it with something like.

if $oElement.tagname(2) = "h1" then msgbox(0, "", $oElement.innerText)

By adding say a 2 to get the 3rd H1 tag... 0,1,2

Edited by tommytx

Share this post


Link to post
Share on other sites



You didn't see _IETagNameGetCollection() right below _IETagNameAllGetCollection() in the help file?

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0