Skip to content

Commit 0d4bef9

Browse files
committed
chore: source -> script in add_init_script messages (#540)
1 parent 0d38538 commit 0d4bef9

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

playwright/_impl/_browser_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async def add_init_script(
157157
with open(path, "r") as file:
158158
script = file.read()
159159
if not isinstance(script, str):
160-
raise Error("Either path or source parameter must be specified")
160+
raise Error("Either path or script parameter must be specified")
161161
await self._channel.send("addInitScript", dict(source=script))
162162

163163
async def expose_binding(

playwright/_impl/_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ async def add_init_script(
524524
with open(path, "r") as file:
525525
script = file.read()
526526
if not isinstance(script, str):
527-
raise Error("Either path or source parameter must be specified")
527+
raise Error("Either path or script parameter must be specified")
528528
await self._channel.send("addInitScript", dict(source=script))
529529

530530
async def route(self, url: URLMatch, handler: RouteHandler) -> None:

tests/async/test_add_init_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def test_add_init_script_throw_without_path_and_content(page):
3939
await page.add_init_script({"foo": "bar"})
4040
except Error as e:
4141
error = e
42-
assert error.message == "Either path or source parameter must be specified"
42+
assert error.message == "Either path or script parameter must be specified"
4343

4444

4545
async def test_add_init_script_work_with_browser_context_scripts(page, context):

tests/sync/test_add_init_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_add_init_script_throw_without_path_and_content(page):
3939
page.add_init_script({"foo": "bar"})
4040
except Error as e:
4141
error = e
42-
assert error.message == "Either path or source parameter must be specified"
42+
assert error.message == "Either path or script parameter must be specified"
4343

4444

4545
def test_add_init_script_work_with_browser_context_scripts(page, context):

0 commit comments

Comments
 (0)