使用casperjs怎么实现网页截图
云計算
本篇文章為大家展示了使用casperjs怎么實現網頁截圖,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
1.安裝casperjs
下載之后解壓到安裝目錄,配置環境變量
2.進入系統命令行
新建一個測試腳本test.js
//登陸人人代碼varcasper=require('casper').create();phantom.outputEncoding="gbk";casper.start('http://www.renren.com',function(){this.fill('form[id="loginForm"]',{'email':'***********','password':'*********'},false);});casper.then(function(){this.click('input[class="input-submitlogin-btn"]');this.echo('clicked...');});casper.then(function(){this.wait(3000,function(){this.capture("renren.png");});});casper.then(function(){this.echo(this.getTitle());});casper.run();
3.進入測試腳本所在文件夾
運行命令
casperjstest.js
上述內容就是使用casperjs怎么實現網頁截圖,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注行業資訊頻道。
總結
以上是生活随笔為你收集整理的使用casperjs怎么实现网页截图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 男人淋病会传染吗
- 下一篇: 坚定修谱的4大原则!专家:缺少一个都可能