Skip to content

fix: env param in BrowserType.launch doesn't serialize properly to Nodejs#612

Merged
pavelfeldman merged 2 commits intomicrosoft:masterfrom
nmashewske:master
Apr 5, 2021
Merged

fix: env param in BrowserType.launch doesn't serialize properly to Nodejs#612
pavelfeldman merged 2 commits intomicrosoft:masterfrom
nmashewske:master

Conversation

@nmashewske
Copy link
Copy Markdown
Contributor

The Nodejs code expects the env param to be of type EnvArr, which is defined as EnvArray = { name: string, value: string }[];
This updates the playwright-python code to format the env dict to the same format to fix the error:
playwright._impl._api_types.Error: env: expected array, got object

Example to reproduce error:

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    env = {"SSLKEYLOGFILE": "~/test"}
    browser = p.chromium.launch(env=env)
    page = browser.new_page()
    page.goto("http://playwright.dev")
    print(page.title())
    browser.close()

The Nodejs code expects the env param to be of type EnvArr, which is defined as EnvArray = { name: string, value: string }[];
This updates the playwright-python code to format the env dict to the same format to avoid crashing
@pavelfeldman pavelfeldman merged commit 4ac3256 into microsoft:master Apr 5, 2021
@pavelfeldman
Copy link
Copy Markdown
Member

It is not the EnvArr that we need to match, but rather a protocol.yml, but the fix is the same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants