Help files

Get Web Browser Element Coordinates

There are cases when you might need to get the coordinates of a web element in a browser, either to hover the mouse to it or send a right click, or simply for getting the coordinates to use them on an image related action.

The "Get details of element on web page" action supports the "waelementcentercoords" attribute which retrieves the X,Y coordinates of the element relative to the browser. However, the X and Y coordinates will be given back by WinAutomation in the form of a text with the two values being separated by a comma like:

%Attribute%= 1021, 52

Therefore, should you wish to separately get the X,Y values you should split the text using "," as a delimiter and then trim them. Also, as their data type is "Text" you will need to convert them to "Number".

You should also note that based on the fact that each browser display area may be different - because of the bookmarks or other bars that the user has chosen to display - you should also use the:

%Browser.DisplayRectangleX%

%Browser.DisplayRectangleY%

variables and finalize the X,Y coordinates that the mouse should move to.

Below, there is an example that will send a right click on a Web Page element after getting its coordinates:

sendrightclickonwebelement.png