Skip to content

Commit 64876ab

Browse files
authored
feat(goto): add authenticate (#599)
1 parent 728e69b commit 64876ab

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,12 @@ default: `false`
568568

569569
Disable CSS [animations](https://developer.mozilla.org/en-US/docs/Web/CSS/animation) and [transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/transition), also it sets [prefers-reduced-motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) consequently.
570570

571+
##### authenticate
572+
573+
type: `object`<br>
574+
575+
It will be passed down to [page.authenticate](https://pptr.dev/api/puppeteer.page.authenticate).
576+
571577
##### click
572578

573579
type: `string``string[]`</br>

packages/goto/src/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -186,21 +186,20 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
186186
abortTypes = [],
187187
adblock = true,
188188
animations = false,
189+
authenticate,
189190
click,
190191
colorScheme,
191192
headers = {},
192193
html,
193194
javascript = true,
194195
mediaType,
195196
modules,
196-
password,
197197
scripts,
198198
scroll,
199199
styles,
200200
timeout,
201201
timezone,
202202
url,
203-
username,
204203
waitForFunction,
205204
waitForSelector,
206205
waitForTimeout,
@@ -219,10 +218,10 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
219218

220219
const prePromises = []
221220

222-
if (username || password) {
221+
if (authenticate) {
223222
prePromises.push(
224223
run({
225-
fn: page.authenticate({ username, password }),
224+
fn: page.authenticate(authenticate),
226225
timeout: actionTimeout,
227226
debug: 'authenticate'
228227
})

0 commit comments

Comments
 (0)