Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the screenshot of a web page with casperjs

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

本篇文章为大家展示了使用casperjs怎么实现网页截图,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

1.安装casperjs

下载之后解压到安装目录,配置环境变量

2.进入系统命令行

新建一个测试脚本test.js

//登陆人人代码var casper = 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-submit login-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.进入测试脚本所在文件夹

运行命令

casperjs test.js上述内容就是使用casperjs怎么实现网页截图,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report