Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nodejs_tutorial
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jameschiu
nodejs_tutorial
Commits
b6b634b3
Commit
b6b634b3
authored
May 25, 2022
by
james
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] init
parent
571b971c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
index.js
index.js
+25
-3
No files found.
index.js
View file @
b6b634b3
const
puppeteer
=
require
(
'
puppeteer
'
);
(
async
()
=>
{
const
accountName
=
'
james.chiu
'
;
const
accountPwd
=
'
Ziteng@123456
'
;
const
browser
=
await
puppeteer
.
launch
({
headless
:
false
// 無外殼的 Chrome,有更佳的效能
});
const
page
=
await
browser
.
newPage
();
await
page
.
goto
(
'
https://google.com
'
);
await
page
.
screenshot
({
path
:
'
example.png
'
});
await
page
.
goto
(
'
https://purplevineip-ilearning.tcl.com/static/admin/#/login
'
);
try
{
await
page
.
waitForSelector
(
'
button.login-btn
'
,{
timeout
:
1000
*
10
});
await
page
.
waitForSelector
(
'
input[type="password"]
'
,{
timeout
:
1000
*
10
});
await
page
.
waitFor
(
1000
);
//等待載入
await
page
.
type
(
'
input[type="text"]
'
,
accountName
);
await
page
.
type
(
'
input[type="password"]
'
,
accountPwd
);
await
page
.
click
(
'
button.login-btn
'
);
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
}
await
browser
.
close
();
//
await browser.close();
})();
\ No newline at end of file
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