playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] `firefoxUserPrefs` doesn't work

Open DetachHead opened this issue 3 years ago • 2 comments

Context:

System:

  • OS: Windows 10 10.0.19044
  • Memory: 1.73 GB / 15.78 GB

Binaries:

  • Node: 18.0.0 - C:\Program Files\nodejs\node.EXE
  • npm: 8.7.0 - C:\Program Files\nodejs\npm.CMD

Languages:

  • Bash: 5.0.17 - C:\WINDOWS\system32\bash.EXE

npmPackages:

  • playwright: ^1.23.0 => 1.23.0

Code Snippet

const { firefox } = require('playwright')

;(async () => {
    const browser = await firefox.launch({firefoxUserPrefs: {'dom.disable_open_during_load':true}})
    const page = await browser.newPage()
})()

Describe the bug

the firefoxUserPrefs argument to browser.launch doesn't work

image

DetachHead avatar Jul 06 '22 06:07 DetachHead

@DetachHead this one is defined in playwright.cfg config file so the preference cannot be changed using the firefoxUserPref.

We might make it work though if we move preferences from config file to the generated user.js instead.

aslushnikov avatar Jul 06 '22 13:07 aslushnikov

I think preferences changed in firefoxUserPrefs should overwrite the ones changed in that config file. There are quite a few preferences in there I can imagine users wanting to change in order to test browser-specific functionality

In my case we want to test how the site reacts to a popup being blocked.

DetachHead avatar Jul 06 '22 23:07 DetachHead