ghost-cursor icon indicating copy to clipboard operation
ghost-cursor copied to clipboard

Protocol error (Input.dispatchMouseEvent): Invalid parameters Failed to deserialize params.x - BINDINGS: double value expected

Open searchingforcode opened this issue 2 years ago • 12 comments

image

This the problem i am facing on when i am running it on the ubuntu 20.04 headless. It works in windows in headless mode.

searchingforcode avatar Aug 25 '22 13:08 searchingforcode

Its happening on 16.1.1 puppeteer version. Its not happening on 16.1.0.

searchingforcode avatar Aug 25 '22 14:08 searchingforcode

I can't reproduce this, can you please check with the latest v1.1.14?

Niek avatar Aug 30 '22 14:08 Niek

I can't reproduce this, can you please check with the latest v1.1.14?

Okay i will check and let you know here.

searchingforcode avatar Aug 31 '22 22:08 searchingforcode

i also get this error while using v1.1.14

chrschae avatar Sep 17 '22 14:09 chrschae

@Niek i have the same issue with 18.0.5 and ghost-cursor 1.1.15

lublak avatar Sep 29 '22 11:09 lublak

error:

Warning: could not move mouse, error message: ProtocolError: Protocol error (Input.dispatchMouseEvent): Invalid parameters Failed to deserialize params.x - BINDINGS: double value expected at position 38

os: windows 10

image result is: NaN NaN

lublak avatar Sep 29 '22 11:09 lublak

Anyone with a simple reproducible script so I can check? I still haven't encountered this issue in the wild.

Niek avatar Sep 29 '22 12:09 Niek

@Niek i created an example for you. It depends on n8n:

npm i n8n -g
n8n
import puppeteer from 'puppeteer';
import { createCursor, installMouseHelper } from 'ghost-cursor';

async function test() {
  const browser = await puppeteer.launch({
    devtools: true,
  });
  const page = await browser.newPage();
  await page.goto(`http://localhost:5678/workflow`);
  await page.addStyleTag({content: '.el-loading-mask{display: none;}'});
  await page.waitForSelector('[data-name=Start]');
  const cursor = createCursor(page);
  await installMouseHelper(page);
  console.log('Settings');
  await page.waitForSelector('#side-menu ul[role="menubar"] li[role=menuitem]:nth-child(7)');
  console.log('Click Settings');
  await cursor.click('#side-menu ul[role="menubar"] li[role=menuitem]:nth-child(7)');
}

test();

https://github.com/n8n-io/n8n

lublak avatar Sep 29 '22 12:09 lublak

path returns an invalid vector array:

[
  { x: 0, y: 0 },     { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN }, { x: NaN, y: NaN },
  ... 1 more item
]

at this position: https://github.com/Xetera/ghost-cursor/blob/master/src/spoof.ts#L359

to is here: { x: 0, y: 0 } { x: NaN, y: NaN } destination is { x: NaN, y: NaN } box is {} options is undefined

lublak avatar Sep 29 '22 14:09 lublak

@Niek i think the issue is here: box https://github.com/Xetera/ghost-cursor/blob/master/src/spoof.ts#L350

lublak avatar Sep 29 '22 14:09 lublak

I still can't replicate this, @lublak I had to change the selector to li[class*="settingsSubmenu"] but then it worked fine.

Niek avatar Oct 11 '22 08:10 Niek

I believe the problem is when the element of the selector doesn't exist. There doesn't seem to be any explicit error handling for this case. Instead, box is {} and the calculations of the x and the y still go ahead - resulting in NaN.

jsdevtom avatar Feb 08 '23 11:02 jsdevtom

This should be resolved by 6de4f444142df963f2b86948cb86067153f3adc0 now that we fire our own Input. dispatchMouseEvent().

Niek avatar May 17 '24 11:05 Niek