diff options
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.js')
-rw-r--r-- | vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.js new file mode 100644 index 00000000..5446b928 --- /dev/null +++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.js @@ -0,0 +1,23 @@ +// Upload an image to imagebin.org + +var page = require('webpage').create(), + system = require('system'), + fname; + +if (system.args.length !== 2) { + console.log('Usage: imagebin.js filename'); + phantom.exit(1); +} else { + fname = system.args[1]; + page.open("http://imagebin.org/index.php?page=add", function () { + page.uploadFile('input[name=image]', fname); + page.evaluate(function () { + document.querySelector('input[name=nickname]').value = 'phantom'; + document.querySelector('input[name=disclaimer_agree]').click() + document.querySelector('form').submit(); + }); + window.setTimeout(function () { + phantom.exit(); + }, 3000); + }); +} |