diff --git a/playwright/_impl/_js_handle.py b/playwright/_impl/_js_handle.py index ce11aaa05..051967282 100644 --- a/playwright/_impl/_js_handle.py +++ b/playwright/_impl/_js_handle.py @@ -98,7 +98,7 @@ def serialize_value(value: Any, handles: List[JSHandle], depth: int) -> Any: if depth > 100: raise Error("Maximum argument depth exceeded") if value is None: - return dict(v="undefined") + return dict(v="null") if isinstance(value, float): if value == float("inf"): return dict(v="Infinity") diff --git a/tests/async/test_evaluate.py b/tests/async/test_evaluate.py index 3505a75fc..8134306e3 100644 --- a/tests/async/test_evaluate.py +++ b/tests/async/test_evaluate.py @@ -142,7 +142,7 @@ async def test_evaluate_return_complex_objects(page): async def test_evaluate_accept_none_as_one_of_multiple_parameters(page): result = await page.evaluate( - '({ a, b }) => Object.is(a, undefined) && Object.is(b, "foo")', + '({ a, b }) => Object.is(a, null) && Object.is(b, "foo")', {"a": None, "b": "foo"}, ) assert result