Jump to content
Sign in to follow this  

MouseClick Coordinates Exist for 2 Controls on Same IE Page

Recommended Posts

I'm using Win7 with IE 11. When I get the coordinates for a control that I want to MouseClick,  the site has another control before it that has the same coordinates.

The control I want to click is Window Class "IEFrame", Control Class "Internet Explorer_Server". The mouse clicks Window Class "IEFrame", Control Class "ToolbarWindow32". (There are instance numbers that change.)

#include <IE.au3>

Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client

Local $hWnd = WinGetHandle("MyWebPage" , "")
Local $oIE = _IEAttach($hWnd, "HWnd")

   Local $oInputs = _IETagNameGetCollection($oIE, "li")
   For $oInput In $oInputs
      If $oInput.classname = "dropdown xxxx-nav-expense_2 active" Then
         Local $iScreenX = _IEPropertyGet($oInput, 'screenx')
         Local $iScreenY = _IEPropertyGet($oInput, 'screeny')
         Local $iBrowserX = _IEPropertyGet($oInput, "browserx")
         Local $iBrowserY = _IEPropertyGet($oInput, "browserY")

            ConsoleWrite("$iScreenX " & $iScreenX & @crlf)
            ConsoleWrite("$iScreenY " & $iScreenY & @crlf)
            ConsoleWrite("$iBrowserX " & $iBrowserX & @crlf)
            ConsoleWrite("$iBrowserY " & $iBrowserY & @crlf)
         ;MouseClick("left",$iScreenX, $iScreenX, 1)
         MouseClick("left",$iScreenY, $iScreenY, 1)

How can I get the mouse to click the second control?

I have attempted the code using the 3 MouseCoordModes. $iScreenX and $iBrowserX always have the same values (360) as do the Y variables (70). Since the numbers never changed when I varied the MouseCoordMode, I un-installed and re-installed AutoIt, thinking that my installation was corrupt.

Thanks in advance.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...