简体   繁体   中英

Puppeteer page.screenshot takes black images in task scheduler

Please help me with the following code:

const puppeteer = require('puppeteer');
var screenshot = require('desktop-screenshot');
    
var screenshot = require('desktop-screenshot');
    
screenshot("screenshot.png", function(error, complete) { if(error) console.log("Screenshot failed", error); else console.log("Screenshot succeeded"); });

When I run file.js locally it runs correctly but when I run it in task scheduler it take a black screenshot and I don't understand why.

To fix it, it is necessary that a session is open with the same user who runs the task, for example: on server01 user01 I start server02 user01 where the task is executed visually with user01.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM