ghost-cursor
ghost-cursor copied to clipboard
Protocol error (Input.dispatchMouseEvent): Invalid parameters Failed to deserialize params.x - BINDINGS: double value expected
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.
Its happening on 16.1.1 puppeteer version. Its not happening on 16.1.0.
I can't reproduce this, can you please check with the latest v1.1.14?
I can't reproduce this, can you please check with the latest v1.1.14?
Okay i will check and let you know here.
i also get this error while using v1.1.14
@Niek i have the same issue with 18.0.5 and ghost-cursor 1.1.15
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
result is: NaN NaN
Anyone with a simple reproducible script so I can check? I still haven't encountered this issue in the wild.
@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
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
@Niek i think the issue is here: box
https://github.com/Xetera/ghost-cursor/blob/master/src/spoof.ts#L350
I still can't replicate this, @lublak I had to change the selector to li[class*="settingsSubmenu"]
but then it worked fine.
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
.
This should be resolved by 6de4f444142df963f2b86948cb86067153f3adc0 now that we fire our own Input. dispatchMouseEvent()
.