Jump to content

dynamic _IELinkClickByText


beserk1
 Share

Recommended Posts

I want to click a link that perform a Java(?) action, but the links is base on the value it generate.

The link contained the follow code

onclick="document.snd.t5.value='321'

When you click on this link, it will put the value '321' in the box name 't5'. However, the name of the link is base on the value, in this case this link text is '(321)'.

Another difficulty is that I have a few links of the same type, so I can't just search for one.

Is there some way I can't search for a link that match centain rules? For example, within a for loop, all those links those contain value greater than 10 would be click, and others would be left alone?

Link to comment
Share on other sites

  • Moderators

See if this works for you.

#include <IE.au3>

$sURL = "www.your-webpage.com"
$oIE = _IECreate($sURL)
$oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
    $sTemp = $oLink.outerText
    $aValue = StringRegExp($sTemp, "(?:\(){1}([:digit:]+)(?:\)){1}", 1)
    If @extended Then
        $iValue = Number($aValue[0])
    Else
        ContinueLoop
    EndIf
    If $iValue > 10 Then
        _IELinkClickByText($oIE, $sTemp)
    EndIf
Next
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...