Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
warden
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚广胤
warden
Commits
dec91658
Commit
dec91658
authored
Apr 10, 2018
by
姚广胤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉编码验证
parent
8783cf66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
photo.js
server/photo.js
+2
-2
No files found.
server/photo.js
View file @
dec91658
...
@@ -27,13 +27,13 @@ puppeteer.launch({
...
@@ -27,13 +27,13 @@ puppeteer.launch({
// tab访问需要截图的页面,使用await可以等待页面加载完毕
// tab访问需要截图的页面,使用await可以等待页面加载完毕
const
response
=
await
page
.
goto
(
websiteUrl
);
const
response
=
await
page
.
goto
(
websiteUrl
);
await
page
.
setContent
((
await
response
.
buffer
()).
toString
(
'utf8'
));
//
await page.setContent((await response.buffer()).toString('utf8'));
// 由于页面数据是异步的,所以等待8秒,等待异步请求完毕,页面渲染完毕
// 由于页面数据是异步的,所以等待8秒,等待异步请求完毕,页面渲染完毕
await
page
.
waitFor
(
8000
)
await
page
.
waitFor
(
8000
)
// 页面渲染完毕后,开始截图
// 页面渲染完毕后,开始截图
await
page
.
screenshot
({
await
page
.
screenshot
({
path
:
'./xxx
2
.png'
,
path
:
'./xxx
3
.png'
,
clip
:
{
clip
:
{
x
:
0
,
x
:
0
,
y
:
0
,
y
:
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment