How to simulate mouse click along with mouse move using javascript
You cannot move the mousepointer with javascript, because of the security implications that it incurs.
use io hook to move puppteer's mouse
In puppeteer documentation website:
https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-class-mouse
Using ‘page.mouse’ to trace a 100x100 square.
await page.mouse.move(0, 0);
await page.mouse.down();
await page.mouse.move(0, 100);
await page.mouse.move(100, 100);
await page.mouse.move(100, 0);
await page.mouse.move(0, 0);
await page.mouse.up();
So to make mouse drag, you've to put some await page.mouse.move()
after an await page.mouse.down()
and before an await page.mouse.up()
page.mouse.click()
is a combination of two event mouse.down()
and mouse.up()
in same position on a very short time delay.
And in IOHook documentation:
https://wilix-team.github.io/iohook/usage.html#mousedrag
Triggered when user clicks and drags something.
{ button: 0, clicks: 0, x: 373, y: 683, type: 'mousedrag' }
So the solution here is, you have to listen the mousedrag event.
Related Topics
How to Filter Date Range in Datatables
Setting Cross-Domain Cookies in Safari
Get Array of Values from Multiple Inputs Using Jquery
How to Download a File With Node.Js (Without Using Third-Party Libraries)
Howto Trigger Input Event Programmatically on Input Text Field
Bootstrap Button Drop-Down Inside Responsive Table Not Visible Because of Scroll
How to Bind Dynamic Check Boxes Value Using Ng-Model
How to Prevent iOS Keyboard from Pushing the View Off Screen With CSS or Js
Javascript Innerhtml Not Updating Element
Charts.Js Graph Not Scaling to Canvas Size
Have a Div Move on Scroll Up and Down
Merge Array of Objects by Same Key-Value
Text Box to Appear When a Radio Button Is Selected
Puppeteer Wait Until Page Is Completely Loaded
How to Get the Ajax Response from Success and Assign It in a Variable Using Jquery
Pdf Blob - Pop Up Window Not Showing Content
How to Create a Dynamic Jquery Data Table With Json Data and Ajax
Get Request Works With Postman But Why Doesn't It Work With Reactjs Fetch