File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -409,17 +409,22 @@ def _browser_context(
409409 auth_password = None ,
410410 record_har_path = None ,
411411):
412- browser_kwargs = dict (
413- headless = not interactive , devtools = devtools , args = browser_args
414- )
412+ # Playwright 1.58 removed the `devtools` launch option. Emulate the
413+ # previous behavior for Chromium by passing the corresponding flag.
414+ args = list (browser_args or [])
415+ browser_kwargs = dict (headless = not interactive , args = args )
415416 if browser == "chromium" :
417+ if devtools and "--auto-open-devtools-for-tabs" not in args :
418+ args .append ("--auto-open-devtools-for-tabs" )
416419 browser_obj = p .chromium .launch (** browser_kwargs )
417420 elif browser == "firefox" :
418421 browser_obj = p .firefox .launch (** browser_kwargs )
419422 elif browser == "webkit" :
420423 browser_obj = p .webkit .launch (** browser_kwargs )
421424 else :
422425 browser_kwargs ["channel" ] = browser
426+ if devtools and "--auto-open-devtools-for-tabs" not in args :
427+ args .append ("--auto-open-devtools-for-tabs" )
423428 browser_obj = p .chromium .launch (** browser_kwargs )
424429 context_args = {}
425430 if auth :
You can’t perform that action at this time.
0 commit comments