Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playwright/_impl/_browser_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async def add_init_script(
with open(path, "r") as file:
script = file.read()
if not isinstance(script, str):
raise Error("Either path or source parameter must be specified")
raise Error("Either path or script parameter must be specified")
await self._channel.send("addInitScript", dict(source=script))

async def expose_binding(
Expand Down
2 changes: 1 addition & 1 deletion playwright/_impl/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ async def add_init_script(
with open(path, "r") as file:
script = file.read()
if not isinstance(script, str):
raise Error("Either path or source parameter must be specified")
raise Error("Either path or script parameter must be specified")
await self._channel.send("addInitScript", dict(source=script))

async def route(self, url: URLMatch, handler: RouteHandler) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/async/test_add_init_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def test_add_init_script_throw_without_path_and_content(page):
await page.add_init_script({"foo": "bar"})
except Error as e:
error = e
assert error.message == "Either path or source parameter must be specified"
assert error.message == "Either path or script parameter must be specified"


async def test_add_init_script_work_with_browser_context_scripts(page, context):
Expand Down
2 changes: 1 addition & 1 deletion tests/sync/test_add_init_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_add_init_script_throw_without_path_and_content(page):
page.add_init_script({"foo": "bar"})
except Error as e:
error = e
assert error.message == "Either path or source parameter must be specified"
assert error.message == "Either path or script parameter must be specified"


def test_add_init_script_work_with_browser_context_scripts(page, context):
Expand Down