Skip to content

Commit

Permalink
feat(goto): add authenticate (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats authored Jan 25, 2025
1 parent 728e69b commit 64876ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,12 @@ default: `false`

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.

##### authenticate

type: `object`<br>

It will be passed down to [page.authenticate](https://pptr.dev/api/puppeteer.page.authenticate).

##### click

type: `string``string[]`</br>
Expand Down
7 changes: 3 additions & 4 deletions packages/goto/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,20 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
abortTypes = [],
adblock = true,
animations = false,
authenticate,
click,
colorScheme,
headers = {},
html,
javascript = true,
mediaType,
modules,
password,
scripts,
scroll,
styles,
timeout,
timezone,
url,
username,
waitForFunction,
waitForSelector,
waitForTimeout,
Expand All @@ -219,10 +218,10 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..

const prePromises = []

if (username || password) {
if (authenticate) {
prePromises.push(
run({
fn: page.authenticate({ username, password }),
fn: page.authenticate(authenticate),
timeout: actionTimeout,
debug: 'authenticate'
})
Expand Down

0 comments on commit 64876ab

Please sign in to comment.