Sign in to follow this  
Followers 0
scooper

how can i count the number of a tag with the same name?

3 posts in this topic

#1 ·  Posted (edited)

Hi all,

I have a site with some javascript link with the same tagname, i need to click all this tag,

this is my script :

CODE

for $i to 5 step 1

_IENavigate($oIe, "www.yyy.com")

$oAs = _IETagnameGetCollection($oIE, "A")

For $oA in $oAs

If String($oA.innerText) = "x" Then

_IEAction($oA, "click")

ExitLoop

EndIf

Next

_IELoadWait ($oIE)

_IELinkClickByIndex ($oIE, 66)

next

This script works but unlike i can't know how many tag with "x" name I have in the page,

so i need a function to count the number of tagname with x

thanks in advance for any help

Edited by scooper

Share this post


Link to post
Share on other sites



Maybe...

Dim $count

For $i = 1 To 5 Step 1

    _IENavigate($oIe, "www.yyy.com")
    $oAs = _IETagNameGetCollection($oIe, "A")
    For $oA In $oAs
        If String($oA.innerText) = "x" Then
            $count += 1
            _IEAction($oA, "click")
            ExitLoop
        EndIf
    Next
    _IELoadWait($oIe)
    _IELinkClickByIndex($oIe, 66)
Next

MsgBox(4096, "count", $count)

*** NOT TESTED

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thankyou Valuater,

your code works fine,

from your I found this solution to count the number of laps to go

CODE
dim $Count

$oAs = _IETagnameGetCollection($oIE, "A")

For $oA in $oAs

If String($oA.innerText) = "x" Then

$Count +=1

EndIf

Next

thanks again

Edited by scooper

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