Jump to content
Sign in to follow this  

Problems clicking image using internet explorer (_IEImgClick)

Recommended Posts

I am running into a few compounding problems:

All I am trying to do is click a continue button using Internet Explorer.

$oIE = _IEAttach("Sprint")
_IEImgClick($oIE, "Continue", "alt",0,0)

The problem is that the website uses javascript once the continue button is pressed. It then causes AutoIT to be nonresponsive until the javascript prompt is clicked. (Javascript confirm function)

The conventional wisdom seems to be to use example 2 on _IEAction as such:

Local $oIE = _IE_Example("form")
Local $oSubmit = _IEGetObjByName($oIE, "submitExample")
Local $hWnd = _IEPropertyGet($oIE, "hwnd")
_IEAction($oSubmit, "focus")
ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

This doesn't work for me either because the javascript is coded in such a way that it only proceeds when clicked by the left mouse button... the enter key seems to refresh the page.

The next thing I tried was to get the coordinates of the Continue button. I get coordinate values back but they don't seem to relate to the button properly.

$oImgs = _IEImgGetCollection($oIE)

For $oImg In $oImgs
    If StringInStr($oImg.src,"ContinueYellow",0) Then
        $ContinueButtonImage = $oImg

$ContinueButtonImageXcoordinate = _IEPropertyGet($ContinueButtonImage,"browserx")
$ContinueButtonImageYcoordinate = _IEPropertyGet($ContinueButtonImage,"browsery")
MouseClick("left",$ContinueButtonImageXcoordinate, $ContinueButtonImageYcoordinate)

Can any advise how to resolve this? Example 3 gets the proper image... if I look at $oImg.src it has the proper URL. Also, I was having trouble getting the scrollintoview option to work... whenever I try _IEAction($ContinueButtonImage, "scrollintoview") it does not work.

I would greatly appreciate any help as I've spent about 5 hours trying to make this work.

Edited by super1337

Share this post

Link to post
Share on other sites

Unfortunately the website requires a login which most people won't have.

I think the follow code below displays my dilemma(or misunderstanding). All I want to do is find the submit button but the coordinates I am getting back have no relationship to where it actually is on the screen

#include <IE.au3>

Local $oIE = _IE_Example("form")
Local $oTextArea = _IEGetObjByName($oIE, "submitExample")
_IEACTION($oTextArea, "scrollintoview")

; Get coordinates and dimensions of the textarea
Local $iScreenX = _IEPropertyGet($oTextArea, "screenx")
Local $iScreenY = _IEPropertyGet($oTextArea, "screeny")
Local $iBrowserX = _IEPropertyGet($oTextArea, "browserx")
Local $iBrowserY = _IEPropertyGet($oTextArea, "browserY")

; Outline the textarea with the mouse, come to rest in the center
Msgbox(0,0,$iScreenX & ' ' & $iScreenY)
Msgbox(0,0,$iBrowserX & ' ' & $iBrowserY)

I guess those coordinates are in relationship to the internet explorer window... not the desktop. How do you use them at that point to click on objects?

Edited by super1337

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  

  • Create New...