Rectangle 27 1

But you can use javascript click() method to simulate click event. To do this work you must use elementFromPoint() to select click position. In my bottom example when you click on first button, javascript simulate second button click.

var first = document.getElementById("first");
var second = document.getElementById("second");

first.addEventListener("click", function(){ 
    var xPos = second.offsetLeft;
    var yPos = second.offsetHeight;
    document.elementFromPoint(xPos, yPos).click();
});

second.addEventListener("click", function(){ 
    alert("Second button clicked!");
});
<button id="first">First</button>
<button id="second">Second</button>

This is ok, click() operation is working very fine.But i need mouse movement, is there any way to achieve mouse moving along with click operation??

@SravaniYapamanu You can't move cursor in browser but you can hide cursor then create cursor image and move it.

can u provide me how can i do that one atleast??

testing - How to simulate mouse click along with mouse move using java...

javascript testing automated-tests simulation
Rectangle 27 0

You cannot simulate a mouse click by coordinate position using javascript (think about what a security problem that would be!), so I don't think you can accomplish what you're looking to do. Plus, there's no programmatic way to look at what layers may exist at an arbitrary x/y position on a page. If you're just trying to debug something and want to see everything at a certain x,y position on the page, just delete each element in Firebug or Chrome inspector when you're done looking at it and use the inspector to see what's underneath it.

If you really need a tool that does what you want, you could use a combination of jquery and a browser add-on. You could write a Chrome or Firefox extension that simulates a real mouse click with event.x and event.y coordinates. You could then use the aforementioned suggestion of capturing all the parents of the clicked element. Once you've catalogued those elements, find the top-most parent of the clicked item, clone it, delete all the clone's elements except the top-most parent itself, and set this top-most parent's background to transparent. Now replace the original element in the DOM with this transparent cloned element. In this way, you preserve the layout of the page, and when you simulate another click, you're actually clicking "through" the top-most element (which is transparent) and clicking the next DOM element (if any) behind it. Repeat the process above until you reach the body tag. In the end, you will have a complete list of all DOM elements at a specific x,y location.

javascript - How can I get the list of DOM elements that are located a...

javascript jquery html dom mouseevent
Rectangle 27 0

If all you want to do is click a button, button elements have a click method that can be invoked:

<input type="button" id="theButton" onclick="javascript:alert('The button was clicked!');" value="A button" />

<script language="javascript">

setTimeout(function(){
    document.getElementById("theButton").click();
}, 1000); // wait one second then click the button

</script>

There's no need to "actually" simulate the mouse click at a specific x,y position.

javascript simulate mouse click on specific position - Stack Overflow

javascript click mouse position simulate
Rectangle 27 0

I dont know if its posible to do that on javascript but if you need automatic and periodic clicks maybe you can do that with external tools like autohotkey

mmmmm ,aybe..... is it possible to move the pointer mouse automatically to certain position on the web page?

with autohotkey you can send a click on the specific coordinates see this page

javascript simulate mouse click on specific position - Stack Overflow

javascript click mouse position simulate