Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

puppeteer create folder

const fs = require('fs');

[...] 
const path = `results/screenshots/${projectname}/${date}`;

try {
     await page.screenshot({ path: `${path}/SiteAdded.png` });
} catch(err) {
     fs.mkdirSync(path);
     await page.screenshot({ path: `${path}/SiteAdded.png` });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript cookies all together 
Javascript :: Create Nodejs logger that does not replace file when app/server restarts 
Javascript :: ngrx angular Cannot add property 0, object is not extensible 
Javascript :: Staircase 
Javascript :: Inside Vs Static Methods 
Javascript :: 1st element in underscore javascript 
Javascript :: react sate and props 
Javascript :: Javascript Area When All Sides are Known 
Javascript :: Good Example: Focus moved to AJAX content with tabindex="-1" after a delay 
Javascript :: how to display unicode in javascript 
Javascript :: Accessing Function Declared Outside Constructor But Inside Class 
Javascript :: Use Dynamic Scales 
Javascript :: A Method In Class That Accesses A Property 
Javascript :: var logNums = function(num) {}; 
Javascript :: javascript remove the second to last character of a string 
Javascript :: useState intro 
Javascript :: var logEvenNums = function(num) {}; 
Javascript :: Backbone Model Validation And Inheritance 
Javascript :: dockerignore node_modules 
Javascript :: React Gotchas 
Javascript :: js check that interactive element is not focused 
Javascript :: data.json 
Javascript :: timezone using javascript 
Javascript :: why null is object in javascript 
Javascript :: regex in javascript 
Javascript :: getcontext in javascript 
Javascript :: JavaScript (SMonkey 60.2.3) sample 
Javascript :: javascript neue zeilekill 
Javascript :: javascript Convert to Number Explicitly 
Javascript :: javascript Passing undefined Value 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =