# Elastic Synthetics Journey: Set \`playwrightOptions\` from parameters

**URL:** https://discuss.elastic.co/t/elastic-synthetics-journey-set-playwrightoptions-from-parameters/330762
**Category:** Synthetics
**Created:** [April 25, 2023, 6:31pm UTC](https://discuss.elastic.co/t/elastic-synthetics-journey-set-playwrightoptions-from-parameters/330762 "2023-04-25T18:31:06Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)
#### Post date: [April 26, 2023, 6:04pm UTC](https://discuss.elastic.co/t/elastic-synthetics-journey-set-playwrightoptions-from-parameters/330762/6 "2023-04-26T18:04:53Z")

</div>

> [@shahzad31](#):
>
> perhaps something like this could be used but it seems like that API on context is deprecated by playwright
> 
> ```auto
> journey(`My Un-Example Journey ${i}`, ({ page, params, context }) => {
> context.setHTTPCredentials({
> username: params.username,
> password: params.password,
> });
> 
> ```

This would be ideal, if it weren't deprecated. Prior to submitting my original post, I did try to follow the [suggestion from the docs](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-http-credentials) to create a new browser context, but it appears that the `@elastic/synthetics` setup creates an initial browser context and runs in that context. In creating a new context, what happened was that it opened a new window that everything ran in, but nothing validated in. If you have a pattern for doing this, it would certainly be an acceptable item, especially if I could configure this in a `beforeAll()`.

> anther solution that will require a pull request is we can apply params to config file just like we do for lightweight yaml with that you will be able to use params in config file like this
> 
> ```auto
> playwrightOptions: {
> ignoreHTTPSErrors: false,
> httpCredentials: {
> username: '${username}',
> password: '${password}',
> },
> },
> 
> ```
> 
> do you think it will be useful?

If it were to be done like this, I would think that something similar to `monitor.use({});` would be more helpful...like a `playwrightOptions.use({})`.

At the moment, setting the `httpCredentials: {}` from environment variables at startup is working for me. And it does resolve the issue where the params values as defined in Synthetics seem to be visible to ANYBODY with access to synthetics, which doesn't seem to be that secure to me.

---

_[View the full topic](https://discuss.elastic.co/t/elastic-synthetics-journey-set-playwrightoptions-from-parameters/330762)._
