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

problem in using the script option #43

Open
ghost opened this issue Jul 26, 2017 · 1 comment
Open

problem in using the script option #43

ghost opened this issue Jul 26, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 26, 2017

Hi,

I would like to click a button before capturing the screen which I add a script option as follows:

const Pageres = require('pageres');

const pageres = new Pageres({
    delay: 2,
    script: "document.querySelector('.coreSpriteRightChevron').click();"
})
	.src('https://www.instagram.com/p/BWh3WDKh5c5/', ['1600x1200'], {crop: true})
	.dest(__dirname)
	.run()
	.then(() => console.log('done'));

but it doesn't work. I tried to change the delay time, put it into different part of the script like in src or run but doesn't work too. Would you please help on this?

@medikoo
Copy link

medikoo commented Aug 18, 2017

@kevva I just approached very same problem.

From what I investigated, problem is that screenshot is grabbed immediately after script invocation (delay option is used for prior logic). Therefore if script action demands some time to propagate (as e.g. click), then there's no chance to achieve the effect.

I can propose as PR with w e.g. scriptDelay option, that will force eventual delay between script evaluation and screenshot grap. Let's just first agree that's best solution for that (?)

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

1 participant