当前位置:网站首页>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
边栏推荐
- Makefile:1860: recipe for target ‘cmake_ check_ build_ system‘ failed make: *** [cmake_check_build_syst
- Codeup longest palindrome substring
- 5分钟快速上线Web应用和API(Vercel)
- [GWCTF 2019]mypassword XSS
- R language data Table data import practice: data Rename the name of the table data column (rename)
- Developing salary management system based on C language course paper + source code and executable EXE file
- Basic MySQL database operations
- Mysql8 installation and environment configuration
- Greedy interval problem (4)
- 322. change exchange
猜你喜欢

pycharm 配置远程连接服务器开发环境

Generate detailed API and parameters of QR code using qrcodejs2

NFT can only be viewed from afar, but not blatantly played

2021-04-16

Redis error reporting and common configurations

Grafana report display of sentinel based high availability current limiting system
![[Li mu] how to read papers [intensive reading of papers]](/img/86/4894bdef31d47d3f9bf3206b997eed.jpg)
[Li mu] how to read papers [intensive reading of papers]

leetcode. 11 --- container with the most water
![Total number of combinations [standard backtracking + backtracking techniques -- reducing stack depth]](/img/88/3a07589bf8edab618139b1bf1680e8.png)
Total number of combinations [standard backtracking + backtracking techniques -- reducing stack depth]

2021-08-26
随机推荐
MySQL multi table operation
What if the SQL execution plan of the production system suddenly becomes worse?
The mental process and understanding of visual project code design
Redis big key problem
Dragon City in Europe | National Geographic the most romantic and safe destination in the world
Business stability construction ideas based on Cloud Architecture
【论文解读】关于基于视觉无人机自主降落平台的论文梳理
【ROS】ROSmsg cakin_ Make compilation error
[chess life] 01 life is like chess
Vs code one key sorting shortcut
2021-05-02
Grafana report display of sentinel based high availability current limiting system
AutoCAD - five annotation shortcuts
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
《强化学习周刊》第50期:SafeRL-Kit、GMI-DRL、RP-SDRL & 离线元强化学习
SQL performance optimization method for interval retrieval
Redis distributed lock
欧洲的龙之城|国家地理全球最浪漫最安全的目的地
Mysql database DML operation exercise
Which is the higher priority of V-IF or V-for?