Jump to content

How to mouse click a link in a page by _IE...?


 Share

Recommended Posts

There's a link "98K993" in a page(website) and I want to use AutoIt to mouse click it.

Here is the code:

<tr bgcolor='#EFEFEF'>

<td width='100%' bgcolor='#DDF0FB' nowrap colspan=4>

<div onclick="form1.SCN_VESREGNO.value='98K993'; form1.submit();"><font face='Arial, Helvetica, sans-serif'>

<u class="hand">98K993<u class="hand">

</font></div>

</td>

</tr>

I don't know how to do it. I've try _IEAction, _IELinkClickBy.... No one work!

Give me a hint, Please!

Link to comment
Share on other sites

Not all things that look like links are links... a "link" is an <a href=xxx>Text</a>

What you have is a <div> with Javascript events defined.

You need to get a reference to the div and then use the _IEAction($oDiv, "click")

$oDivs = _IETagnameGetCollection($oIE, "div")
For $oDiv in $oDivs
    If String(_IEPropertyGet($oDiv, "innertext"), "98K993") Then
        _IEAction($oDiv, "click")
        ExitLoop
    EndIf
Next

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Not all things that look like links are links... a "link" is an <a href=xxx>Text</a>

What you have is a <div> with Javascript events defined.

You need to get a reference to the div and then use the _IEAction($oDiv, "click")

$oDivs = _IETagnameGetCollection($oIE, "div")
For $oDiv in $oDivs
    If String(_IEPropertyGet($oDiv, "innertext"), "98K993") Then
        _IEAction($oDiv, "click")
        ExitLoop
    EndIf
NextoÝ÷ Ø6¥{ú®¢×©ä±©h´ 趫¦ºéêÞßÛ,z÷«jYmv+à´¯i'+^½éí²)íêZæ§tÛhrXëÞ¯*'zÚ zÛ(ëax|+×­ç(uæÞq©è'$¶»-%«ÚIÊâ¦×¯z{H¶ÇËajÝ7êâ¾Ç!jx³^ø«²×%É)z·è®e¡jÛ!¢é]!ÚºÚ"µÍÌÍÛÑ]ÈHÒQUYÛ[YQÙ]ÛÛXÝ[Û   ÌÍÛÒQK  ][ÝÙ]][ÝÊBÜ    ÌÍÛÑ][  ÌÍÛÑ]ÂÒQPXÝ[Û   ÌÍÛÑ]   ][ÝØÛXÚÉ][ÝÊBÙÙ]ÛÛYH[ÜX][Û[HYÙBÒQPXÝ[Û ÌÍÛÒQK  ][ÝØXÚÉ][ÝÊB^
Link to comment
Share on other sites

I'm guessing that the page refreshes when you click... if so, the objects on the initial page are all destroyed and are no longer valid -- you need to start over with the _IETagnameGetCollection

Note however that _IETagnameGetCollection returns the number of matches in @extended and you can also get a reference to a simple element by passing an index value in as the 3rd parameter to the function. See the helpfile.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...