Jump to content

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


Recommended Posts

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
Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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