Jump to content

imageClick


Recommended Posts

I am automating a web button with no text but the id=down_button in source code below.

How do I get this done??

<TR><TD id="down_button" align="left"><A onmouseup="return stopPanDown();" class="down" onmousedown="return startPanDown();" onmouseover="window.status='move down'; return true;" onclick="return false" onmouseout="window.status=''; stopThreads()" href=" ">&nbsp;</A></TD></TR>

Link to comment
Share on other sites

  • 2 weeks later...

<td id="zoomin_button" style="padding-bottom: 2px; padding-left: 20px">

<ul id="buttonh"><li class="zoomin"><a href="" class="zoomin"

onclick="return false"

onmousedown="return startZoomIn();"

onmouseup="return stopZoomIn();"

onmouseover="window.status='zoom in'; return true;"

onmouseout="window.status=''; stopThreads()">&nbsp;</a></li></ul></td>

when I use

$obut = _IEGetObjById($oIE, "zoomin_button")

_IEAction($obut, "click") --->> this doesn't initiate the mouse click

$obutt = _IEGetObjById($oIE, "buttonh")

_IEAction($obutt, "click") --->> this doesn't initiate the mouse click

when I use

_IENavigate($oIE, "java script:startZoominIn();")--->>> this works but buggy.

on the webUI onclick initiate the intended user action but on autoit, it doesn't

Edited by diikee
Link to comment
Share on other sites

$obt=_IEGetObjById($oIE, "buttonh")

$isX = _IEPropertyGet($obt, "screenx")

$isY = _IEPropertyGet($obt, "screeny")

$ibX = _IEPropertyGet($obt, "browserx")

$ibY = _IEPropertyGet($obt, "browsery")

$iW = _IEPropertyGet($obt, "width")

$iH = _IEPropertyGet($obt, "height")

MouseMove($isX, $isY)

MouseMove($isX + $iW, $isY)

MouseMove($isX + $iW, $isY + $iH)

MouseMove($isX, $isY + $iH)

MouseMove($isX, $isY)

MouseMove($isX + $iW/2, $isY + $iH/2)

_IEAction($obt, "click")

How do I cause the mouse click soon as I get the coordinates figured out??

Link to comment
Share on other sites

Your trouble is that the zoom function is not tied to zoomin_button, which is actually a table cell. It is tied to a link inside the table cell.

In addition, it is not really a click that you want... you want mouseDown and mouseUp events.

You could try:

$oIE.document.parentwindow.execScript('startZoomIn();')

Sleep(100)

$oIE.document.parentwindow.execScript('stopZoomIn();')

or you could try

_IEAction($obt, "focus")

followed by standard AutoIt MouseDown and MouseUp commands

If you need to get a reference to the link, your need to use _IELinkGetCollection with an index parameter to get the specific one you need.

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

#include <IE.au3>

;#cs

$ip = InputBox("Get Ip Address", "Enter IP Address: ")

$oIE = _IECreate($ip, 0)

_IENavigate($oIE, $ip)

_IELoadWait($oIE)

;_IELinkClickByText($oIE, "index")

;_IELoadWait($oIE)

for $i = 1 to 3 Step 1

$oIE.document.parentwindow.ExecuteScript('startZoomin();')

Sleep(100)

$oIE.document.parentwindow.ExecuteScript('stopZoomin();')

Next

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\autoit\L.au3"

C:\autoit\L.au3 (12) : ==> The requested action with this object has failed.:

$oIE.document.parentwindow.ExecuteScript('startZoomin();')

$oIE.document.parentwindow.ExecuteScript('startZoomin();')^ ERROR

>Exit code: 1 Time: 19.849

Link to comment
Share on other sites

It's execScript not ExecuteScript

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

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\autoit\L.au3"

C:\autoit\L.au3 (13) : ==> The requested action with this object has failed.:

$oIE.document.parentwindow.execScript("startZoomin();")

$oIE.document.parentwindow.execScript("startZoomin();")^ ERROR

>Exit code: 1 Time: 15.617

where is this section (document.parentwindow.execScript) explained in the help files??

Link to comment
Share on other sites

Try this:

$oIE.document.parentwindow.execScript('var x = 9; alert(x * 12);')

if it works and the other doesn't, it means that startZoomin(); is returning an error. There is no way to help you further without access to the site.

Dale

p.s. Oh, and where is it documented? MSDN (see my sig) - it is part of Internet Explorere, Javascript and the DOM.

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