Skip to main content

How to find the X Y Coordinates

function alertMousePos(event) {
alert(
"X: " + event.clientX +
" - Y: " + event.clientY);
}
document.addEventListener("click", alertMousePos);

  1. Just copy and paste the above code into the browser’s console and press the ‘Enter’ key.

  2. Now click on wherever on the page- An alert will get displayed with x and y values -- It gets the x, and y coordinates of the click of the mouse pointer. Note - Any console (Normal browser or test designer browser) should work, but advisable to use the Test Designer browser in maximized state.


Last updated: June 02, 2023

If you have any feedback on this topic, please contact us at documentation@appvance.ai