projects
/
mkws-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
indent
[mkws-moved-to-github.git]
/
test
/
phantom
/
screenshot.js
diff --git
a/test/phantom/screenshot.js
b/test/phantom/screenshot.js
index
ac4de3b
..
22f044f
100644
(file)
--- a/
test/phantom/screenshot.js
+++ b/
test/phantom/screenshot.js
@@
-3,12
+3,25
@@
var page = require('webpage').create(),
var url = system.args[1] || 'http://www.indexdata.com/';
var file_png = system.args[2] || 'indexdata.png';
var url = system.args[1] || 'http://www.indexdata.com/';
var file_png = system.args[2] || 'indexdata.png';
+var timeout = system.args[5] ? system.args[5] : 0.2;
-if (system.args.length === 1) {
- console.log('Usage: screenshot.js <some URL> <file.png>');
+function usage(message) {
+ if (message) {
+ console.log(message + "\n");
+ }
+ console.log('Usage: screenshot.js <some URL> <file.png> <width px> <height px> <timeout sec>');
phantom.exit();
}
phantom.exit();
}
+if (system.args.length === 1) {
+ usage();
+}
+
+if (!file_png.match(/\.png$/)) {
+ usage("File name has no .png extension: '" + file_png + "'");
+}
+
+
// page.zoomFactor = 1.0;
page.viewportSize = {
width: system.args[3] ? system.args[3] : 1200,
// page.zoomFactor = 1.0;
page.viewportSize = {
width: system.args[3] ? system.args[3] : 1200,
@@
-25,5
+38,7
@@
page.open(url, function () {
setTimeout(function () {
var ret = page.render(file_png);
phantom.exit();
setTimeout(function () {
var ret = page.render(file_png);
phantom.exit();
- }, 200);
+ }, timeout * 1000);
});
});
+
+// EOF