Skip to content

Commit

Permalink
doc: add Advanced configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Mar 30, 2024
1 parent cfe6a5c commit 6a12fbd
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/guides/9-adv-conf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
label: Configurations avancées
icon: zap
order: 0
---

# Cas d'usages et configurations avancées

## Audit d'un site nécessitant un cookie

> Obligation de créer cookie pour fermer une popin, par exemple.
### Utilisation du fichier `extra-header.json`

```json
{ "Cookie": "monster=blue", "x-men": "wolverine" }
```

### Utilisation du fichier `input-file.json`

```json
{
"extra-header": {
"Cookie": "monster=blue",
"x-men": "wolverine"
}
// ...
}
```

## Audit d'un site à accès sécurisé

Utilisation d'un `.puppeteerrc.cjs` custom.

> À adapter suivant le type d'authentification.
```javascript
module.exports = async (browser, context) => {
// launch browser for LHCI
const page = await browser.newPage(context.options)
page.authenticate({ username: '<to update>', password: '<to update>' })
const session = await page.target().createCDPSession()
await page.goto(context.url, { waitUntil: 'networkidle0' })
await startEcoindexPageMesure(page, session)
await endEcoindexPageMesure()
// close session for next run
await page.close()
}
```

0 comments on commit 6a12fbd

Please sign in to comment.