Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use MouseHelper #12

Closed
fishing4chicken opened this issue Nov 11, 2020 · 2 comments
Closed

How to use MouseHelper #12

fishing4chicken opened this issue Nov 11, 2020 · 2 comments

Comments

@fishing4chicken
Copy link

I see the latest version includes installMouseHelper, is this supposed to work like the video in the README, where you can see a small grey circle where the cursor moves?

If so, could you help explain how to set it up? I am a little new to the node.js game and this was my best guess:

const { installMouseHelper } = require('ghost-cursor');
await installMouseHelper(page)

But I don't see the same grey circle when I use Puppeteer in head-full mode.

Really appreciate the Ghost-cursor team! Ghost-cursor is awesome

@Niek
Copy link
Collaborator

Niek commented Nov 12, 2020

I really need to update the documentation (PRs are welcome ;))

This is a short sample code:

const { createCursor, getRandomPagePoint, installMouseHelper } = require('ghost-cursor');

// launch puppeteer first, initialize page, etc. then:

const cursor = createCursor(page, await getRandomPagePoint(page));
await installMouseHelper(page);

await page.goto('https://old.reddit.com/');
await cursor.click('.footer a', { waitForMouse: 10000, waitForSelector: 1000, paddingPercentage: 20 });

@fishing4chicken
Copy link
Author

Thanks Niek!

The problem I had was that I my"installMouseHelper(page)" was after "page.goto()" , instead of before

Works perfectly now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants