Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Either path or source parameter must be specified #534

Closed
YusukeIwaki opened this issue Feb 26, 2021 · 3 comments · Fixed by #540
Closed

Either path or source parameter must be specified #534

YusukeIwaki opened this issue Feb 26, 2021 · 3 comments · Fixed by #540
Labels

Comments

@YusukeIwaki
Copy link

I found a little confusing error message.

from playwright.sync_api import sync_playwright

with sync_playwright() as playwright:
    browser = playwright.chromium.launch()
    try:
        page = browser.new_page()
        page.add_init_script()
    finally:
        browser.close()

This code throws an error Either path or source parameter must be specified
However page.add_init_script doesn't have source parameter.

IMHO, Either path or script parameter must be specified would be better.

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Feb 27, 2021

It has source parameter :

def add_init_script(
self, script: str = None, *, path: typing.Union[str, pathlib.Path] = None
) -> NoneType:
"""Page.add_init_script
Adds a script which would be evaluated in one of the following scenarios:
- Whenever the page is navigated.
@YusukeIwaki

@YusukeIwaki
Copy link
Author

It has 'script' instead of source.

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Feb 28, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants