Jump to content
Sign in to follow this  
DavidTunnell

move mouse to a particular piece of text on a webpage?

Recommended Posts

DavidTunnell

Is it possible to move the mouse cursor to hover over a particular work that is on a webpage? I don't want to use coordinates because I am creating a script that multiple people will use with various resoultions / number of monitors.

Share this post


Link to post
Share on other sites
DW1

Sure, use _IEPropertyGet() like this:

#include <IE.au3>

Local $oIE = _IE_Example("basic")
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    MouseMove(_IEPropertyGet($oLink, "screenx") + (_IEPropertyGet($oLink, "width") / 2), _IEPropertyGet($oLink, "screeny") + (_IEPropertyGet($oLink, "height") / 2), 0)
    MsgBox(0, "Link Info", "Moved mouse to center of link with URL:" & @CRLF & $oLink.href)
Next
  • Like 1

Share this post


Link to post
Share on other sites
DavidTunnell

IS it possible in Chrome? The web application I am using does not run correctly in IE.

Share this post


Link to post
Share on other sites
DW1

IS it possible in Chrome? The web application I am using does not run correctly in IE.

I'm not sure.  There may be a plugin of some kind that opens a com object for chrome.  Search the forum for chrome automation.

Besides that, you could use pixels/image searching, but that's a bit sloppy compared to working directly with the browser.  IIRC there are some posts around here about Chrome automation.

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  

×