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
8783cf66
Commit
8783cf66
authored
Apr 10, 2018
by
姚广胤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试utf-8
parent
ab56688c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
photo.js
server/photo.js
+3
-2
No files found.
server/photo.js
View file @
8783cf66
...
@@ -26,13 +26,14 @@ puppeteer.launch({
...
@@ -26,13 +26,14 @@ puppeteer.launch({
});
});
// tab访问需要截图的页面,使用await可以等待页面加载完毕
// tab访问需要截图的页面,使用await可以等待页面加载完毕
await
page
.
goto
(
websiteUrl
);
const
response
=
await
page
.
goto
(
websiteUrl
);
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
1
.png'
,
path
:
'./xxx
2
.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