In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use puppeteer in function calculation, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand it.
Using puppeteer combined with function calculation, you can quickly build flexible services to complete various functions, including:
Generate a screenshot of a web page or PDF
Advanced crawler that can crawl a large number of web pages that render content asynchronously
Simulate keyboard input, automatic form submission, login web page, etc., to realize UI automatic test.
Capture the timeline of the site to track your site and help analyze site performance problems
Next, we will develop our own puppeteer project based on a scaffolding project.
Download the project
> git clone-o starter-kit https://github.com/awesome-fc/puppeteer-fc-starter-kit.git your_project_name
Project structure
The shared libraries that ├── lib chrome headless depends on are copied to the root directory of the packaged project when packaged.
├── chrome
│ ├── buildChrome.sh compiles the chrome headless shell script, based on which you can compile the latest version
Chrome headless binary package file compiled by │ └── headless_shell.tar.gz
├── src
│ ├── index.js function call entry file, function handler is index.handler, and your business code is written here
│ └── starter-kit
│ ├── config.js acquires relevant configuration properties through environment variables, such as chrome execution directory and installation directory
│ ├── local.js locally tests whether the API of the operation chrome headless is correct, by executing the command: npm run local
│ └── setup.js installs chrome headless-related logic code, such as OSS-based installation or local directory installation
├── package.json
The └── package.zip output function calculates the package file through the command: npm run package or npm run package-nochrome
How to write business code
Index.js file
Cost
Thank you for reading this article carefully. I hope the article "how to use puppeteer in function calculation" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.