当前位置:网站首页>Phantomjs实用代码段(持续更新中……)
Phantomjs实用代码段(持续更新中……)
2022-06-22 20:43:00 【马克社区】
一、下载
下载链接 二、解压安装包
直接解压即可 三、配置环境变量
找到高级系统设置,打开它,出现以下图。点击环境变量。
分别点击编辑按钮
分别新建添加当初的解压路径,到bin文件夹。点击确定。
这样,环境变量配置好了,可以再命令行工具直接使用phantomjs命令。 四、代码段
新建一个JS文件,如:main.js
执行命令:phantomjs main.js1、打印指定网址标题
var page = require(‘webpage’).create(); phantom.outputEncoding=“gbk”; page.open(“https://url.163.com/EWS”, function(status) { console.log("Status: " + status); if ( status === “success” ) { console.log(page.title) } else { console.log(“Page failed to load.”); } phantom.exit(0); });
2、生成网页截图
var page = require(‘webpage’).create(); page.open(‘https://maomin.blog.csdn.net/’, function() { page.render(‘github.png’); phantom.exit(); });
3、将网页转换为PDF
更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/119906672
边栏推荐
- Experiment 4 operation comparison between NoSQL and relational database
- [path planning] week 1: Path Planning open source code summary (ROS) version
- Business stability construction ideas based on Cloud Architecture
- Grafana report display of sentinel based high availability current limiting system
- R language data Table data import practice: data Rename the name of the table data column (rename)
- 2021-08-21
- Core and semiconductor "RF eda/ filter design platform" shines ims2022
- Liunx installing MySQL
- MySQL functions
- [path planning] week 1: hodgepodge
猜你喜欢

Pycharm configuring remote connection server development environment

Las point cloud data thinning in ArcGIS

Why do you perform performance tests before the software goes online? How to find a software performance testing organization

2021-08-21

Uniapp applet mall develops thinkphp6 points mall, group purchase and seckill packaged app
![Next permutation [give play to subjective initiative to discover laws]](/img/bb/262e1a21e4babb8d221d737ced3bcc.png)
Next permutation [give play to subjective initiative to discover laws]

Explain the startup process of opengauss multithreading architecture in detail

2021-04-14

What are the indicators, dimensions and models in Business Intelligence BI data warehouse?

Reasons for the failure of digital transformation and the way to success
随机推荐
Greedy distribution problem (2)
Kdd'22 | Ali: fine tuning CTR estimation based on EE exploration
R language data Table data import practice: data Rename the name of the table data column (rename)
Generate detailed API and parameters of QR code using qrcodejs2
2021-08-21
Business stability construction ideas based on Cloud Architecture
Use full function simulation design method
R language builds a binary classification model based on H2O package: using H2O GLM constructs regularized logistic regression model and uses H2O AUC value of AUC calculation model
【象棋人生】01 人生如棋
Liunx installing MySQL
The xinjietu x70s has been listed for 87900 times and has leapfrogged the class in space safety. It is worthy of being a 7-seat SUV of the National University of China
Huawei cloud recruits partners in the field of industrial intelligence to provide strong support + commercial realization
2020-12-04
A case of misuse of append
Several ways of redis persistence -- deeply parsing RDB
Several methods of changing 91 Oracle common table into partitioned table
【李沐】 如何读论文【论文精读】
SQL performance optimization method for interval retrieval
A SQL optimization case using order by and rownum
Some shaders in AB package do not trigger the callback of ipreprocessshaders