From ee213f639ab67d0818346be75b8259a5fba87362 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Sun, 10 Dec 2017 20:22:18 +0100 Subject: [PATCH] add support for basic auth add username and password setting --- audits.js | 5 +++++ cli.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/audits.js b/audits.js index 750adc8..4a54450 100644 --- a/audits.js +++ b/audits.js @@ -36,6 +36,11 @@ webpage.viewportSize = { height: opts.height }; +if (opts.username && opts.password) { + webpage.settings.userName = opts.username; + webpage.settings.password = opts.password; +} + webpage.onResourceTimeout = function (err) { console.error('Error code:' + err.errorCode + ' ' + err.errorString + ' for ' + err.url); phantom.exit(1); diff --git a/cli.js b/cli.js index 9359986..6f95a46 100755 --- a/cli.js +++ b/cli.js @@ -17,6 +17,8 @@ const cli = meow(` Options --viewport-size= Set the viewport size + --username= Set the basicauth username + --password= Set the basicauth password --delay Set the delay capturing the page --verbose Display more information