Jump to content
Sign in to follow this  
Zohar

How to Check if the MouseCursor is Within the Area of a Web Element?

Recommended Posts

Zohar

Hello

Let's say I have a webpage, with some elements in it, like Image, Table, etc.

I want to check if the user's mouse is Inside the Table's area for example,

what is the simplest way to check it?

Thank you

Share this post


Link to post
Share on other sites
Authenticity

; 1
#include <IE.au3>

Dim $oIE = _IE_Example('table')
Dim $JScript

$JScript = 'alert("Entering table");'
_IEHeadInsertEventScript($oIE, 'tableOne', 'onmouseenter', $JScript)

$JScript = 'alert("Leaving table");'
_IEHeadInsertEventScript($oIE, 'tableOne', 'onmouseleave', $JScript)

; 2
#include <IE.au3>

Dim $oIE = _IE_Example('table')
Dim $oTable = _IEGetObjByName($oIE, 'tableOne')

ObjEvent($oTable, 'Table_')

While _IEPropertyGet($oIE, 'visible')
    Sleep(100)
WEnd

Exit

Func Table_onmouseenter()
    ConsoleWrite('Entering table' & @LF)
EndFunc

Func Table_onmouseleave()
    ConsoleWrite('Leaving table' & @LF)
EndFunc

Share this post


Link to post
Share on other sites
Zohar

anyone knows if there's a way that the Event Handler will call code inside my AutoIt program rather than a Javascript block?

For example,

If I need the onmouseenter event to change the Value of a variable in my AutoIt code, or to run an AutoIt Block rather than Javascript one..

Thank you

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.