-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Hey guys, thank you for this library, I'm really loving it (especially in comparison with the PhantomJS backend).
I'm creating screenshots of a page with multiple views with the following code.
The views are changed in the nextView function.
for (var i = 0; i < count; i++) {
nightmare
.wait(2000)
.screenshot(path.resolve(__dirname, i + '.png'))
.evaluate(nextView)
}
nightmare
.end()
.then(function() {
console.log("Done")
}).catch(function(err) {
console.error(err);
})This works great on most pages, but it hangs on a specific page (I'm sorry I can't disclose the contents).
Here is a part of the log:
nightmare:actions .evaluate() fn on the page +2ms
nightmare:actions .wait() for 2000ms +6ms
nightmare:actions .screenshot() +2s
nightmare:log subscribing to browser window frames +1ms
nightmare:log altering page to force rendering +0ms
nightmare:log unsubscribing from browser window frames +57ms
nightmare:actions .screenshot() captured with length 342104 +606ms
nightmare:actions .evaluate() fn on the page +2ms
nightmare:actions .wait() for 2000ms +392ms
nightmare:actions .screenshot() +2s
nightmare:log subscribing to browser window frames +0ms
nightmare:log altering page to force rendering +0ms
As you can see, the screenshot before renders nicely, but the last one does not seem to do anything.
The requestFrame function doesn't seem to call its callback.
Do you have any tips for me to debug this? Setting a waitTimeout doesn't help since I'm not waiting.
Update: Okay, I tried again with show: yes and manually triggered a re-render and it worked. Maybe I'll try to click on something to trigger that render manually every time.
Update 2: Since it's only waiting for change after the screenshot action, calling scrollTo or click before doesn't help.
Update 3: I tested it and the callback doesn't get called in the requestFrame function for this screenshot (all the other shots are working fine).
Update 4: I'm just calling the callback directly in requestFrame which is bad, but works for me. Gonna leave this issue open though.