diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py
index 3f69f7acb..9d7e86a1f 100644
--- a/playwright/async_api/_generated.py
+++ b/playwright/async_api/_generated.py
@@ -608,7 +608,7 @@ def request(self) -> "Request":
"""
return mapping.from_impl(self._impl_obj.request)
- async def abort(self, error_code: str = None) -> NoneType:
+ async def abort(self, error_code: typing.Optional[str] = None) -> NoneType:
"""Route.abort
Aborts the route's request.
@@ -640,12 +640,12 @@ async def abort(self, error_code: str = None) -> NoneType:
async def fulfill(
self,
*,
- status: int = None,
+ status: typing.Optional[int] = None,
headers: typing.Optional[typing.Dict[str, str]] = None,
- body: typing.Union[str, bytes] = None,
- path: typing.Union[str, pathlib.Path] = None,
- content_type: str = None,
- response: "APIResponse" = None
+ body: typing.Optional[typing.Union[str, bytes]] = None,
+ path: typing.Optional[typing.Union[str, pathlib.Path]] = None,
+ content_type: typing.Optional[str] = None,
+ response: typing.Optional["APIResponse"] = None
) -> NoneType:
"""Route.fulfill
@@ -698,10 +698,10 @@ async def fulfill(
async def fallback(
self,
*,
- url: str = None,
- method: str = None,
+ url: typing.Optional[str] = None,
+ method: typing.Optional[str] = None,
headers: typing.Optional[typing.Dict[str, str]] = None,
- post_data: typing.Union[str, bytes] = None
+ post_data: typing.Optional[typing.Union[str, bytes]] = None
) -> NoneType:
"""Route.fallback
@@ -781,10 +781,10 @@ async def handle(route, request):
async def continue_(
self,
*,
- url: str = None,
- method: str = None,
+ url: typing.Optional[str] = None,
+ method: typing.Optional[str] = None,
headers: typing.Optional[typing.Dict[str, str]] = None,
- post_data: typing.Union[str, bytes] = None
+ post_data: typing.Optional[typing.Union[str, bytes]] = None
) -> NoneType:
"""Route.continue_
@@ -936,7 +936,11 @@ def url(self) -> str:
return mapping.from_maybe_impl(self._impl_obj.url)
def expect_event(
- self, event: str, predicate: typing.Callable = None, *, timeout: float = None
+ self,
+ event: str,
+ predicate: typing.Optional[typing.Callable] = None,
+ *,
+ timeout: typing.Optional[float] = None
) -> AsyncEventContextManager:
"""WebSocket.expect_event
@@ -965,7 +969,11 @@ def expect_event(
)
async def wait_for_event(
- self, event: str, predicate: typing.Callable = None, *, timeout: float = None
+ self,
+ event: str,
+ predicate: typing.Optional[typing.Callable] = None,
+ *,
+ timeout: typing.Optional[float] = None
) -> typing.Any:
"""WebSocket.wait_for_event
@@ -1081,7 +1089,9 @@ async def insert_text(self, text: str) -> NoneType:
return mapping.from_maybe_impl(await self._impl_obj.insert_text(text=text))
- async def type(self, text: str, *, delay: float = None) -> NoneType:
+ async def type(
+ self, text: str, *, delay: typing.Optional[float] = None
+ ) -> NoneType:
"""Keyboard.type
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text.
@@ -1108,7 +1118,9 @@ async def type(self, text: str, *, delay: float = None) -> NoneType:
await self._impl_obj.type(text=text, delay=delay)
)
- async def press(self, key: str, *, delay: float = None) -> NoneType:
+ async def press(
+ self, key: str, *, delay: typing.Optional[float] = None
+ ) -> NoneType:
"""Keyboard.press
`key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
@@ -1157,7 +1169,9 @@ async def press(self, key: str, *, delay: float = None) -> NoneType:
class Mouse(AsyncBase):
- async def move(self, x: float, y: float, *, steps: int = None) -> NoneType:
+ async def move(
+ self, x: float, y: float, *, steps: typing.Optional[int] = None
+ ) -> NoneType:
"""Mouse.move
Dispatches a `mousemove` event.
@@ -1175,8 +1189,8 @@ async def move(self, x: float, y: float, *, steps: int = None) -> NoneType:
async def down(
self,
*,
- button: Literal["left", "middle", "right"] = None,
- click_count: int = None
+ button: typing.Optional[Literal["left", "middle", "right"]] = None,
+ click_count: typing.Optional[int] = None
) -> NoneType:
"""Mouse.down
@@ -1197,8 +1211,8 @@ async def down(
async def up(
self,
*,
- button: Literal["left", "middle", "right"] = None,
- click_count: int = None
+ button: typing.Optional[Literal["left", "middle", "right"]] = None,
+ click_count: typing.Optional[int] = None
) -> NoneType:
"""Mouse.up
@@ -1221,9 +1235,9 @@ async def click(
x: float,
y: float,
*,
- delay: float = None,
- button: Literal["left", "middle", "right"] = None,
- click_count: int = None
+ delay: typing.Optional[float] = None,
+ button: typing.Optional[Literal["left", "middle", "right"]] = None,
+ click_count: typing.Optional[int] = None
) -> NoneType:
"""Mouse.click
@@ -1252,8 +1266,8 @@ async def dblclick(
x: float,
y: float,
*,
- delay: float = None,
- button: Literal["left", "middle", "right"] = None
+ delay: typing.Optional[float] = None,
+ button: typing.Optional[Literal["left", "middle", "right"]] = None
) -> NoneType:
"""Mouse.dblclick
@@ -1317,7 +1331,9 @@ async def tap(self, x: float, y: float) -> NoneType:
class JSHandle(AsyncBase):
- async def evaluate(self, expression: str, arg: typing.Any = None) -> typing.Any:
+ async def evaluate(
+ self, expression: str, arg: typing.Optional[typing.Any] = None
+ ) -> typing.Any:
"""JSHandle.evaluate
Returns the return value of `expression`.
@@ -1353,7 +1369,7 @@ async def evaluate(self, expression: str, arg: typing.Any = None) -> typing.Any:
)
async def evaluate_handle(
- self, expression: str, arg: typing.Any = None
+ self, expression: str, arg: typing.Optional[typing.Any] = None
) -> "JSHandle":
"""JSHandle.evaluate_handle
@@ -1629,7 +1645,7 @@ async def is_visible(self) -> bool:
return mapping.from_maybe_impl(await self._impl_obj.is_visible())
async def dispatch_event(
- self, type: str, event_init: typing.Dict = None
+ self, type: str, event_init: typing.Optional[typing.Dict] = None
) -> NoneType:
"""ElementHandle.dispatch_event
@@ -1675,7 +1691,9 @@ async def dispatch_event(
)
)
- async def scroll_into_view_if_needed(self, *, timeout: float = None) -> NoneType:
+ async def scroll_into_view_if_needed(
+ self, *, timeout: typing.Optional[float] = None
+ ) -> NoneType:
"""ElementHandle.scroll_into_view_if_needed
This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, then tries to scroll element into view, unless it is
@@ -1702,10 +1720,10 @@ async def hover(
modifiers: typing.Optional[
typing.List[Literal["Alt", "Control", "Meta", "Shift"]]
] = None,
- position: Position = None,
- timeout: float = None,
- force: bool = None,
- trial: bool = None
+ position: typing.Optional[Position] = None,
+ timeout: typing.Optional[float] = None,
+ force: typing.Optional[bool] = None,
+ trial: typing.Optional[bool] = None
) -> NoneType:
"""ElementHandle.hover
@@ -1754,14 +1772,14 @@ async def click(
modifiers: typing.Optional[
typing.List[Literal["Alt", "Control", "Meta", "Shift"]]
] = None,
- position: Position = None,
- delay: float = None,
- button: Literal["left", "middle", "right"] = None,
- click_count: int = None,
- timeout: float = None,
- force: bool = None,
- no_wait_after: bool = None,
- trial: bool = None
+ position: typing.Optional[Position] = None,
+ delay: typing.Optional[float] = None,
+ button: typing.Optional[Literal["left", "middle", "right"]] = None,
+ click_count: typing.Optional[int] = None,
+ timeout: typing.Optional[float] = None,
+ force: typing.Optional[bool] = None,
+ no_wait_after: typing.Optional[bool] = None,
+ trial: typing.Optional[bool] = None
) -> NoneType:
"""ElementHandle.click
@@ -1824,13 +1842,13 @@ async def dblclick(
modifiers: typing.Optional[
typing.List[Literal["Alt", "Control", "Meta", "Shift"]]
] = None,
- position: Position = None,
- delay: float = None,
- button: Literal["left", "middle", "right"] = None,
- timeout: float = None,
- force: bool = None,
- no_wait_after: bool = None,
- trial: bool = None
+ position: typing.Optional[Position] = None,
+ delay: typing.Optional[float] = None,
+ button: typing.Optional[Literal["left", "middle", "right"]] = None,
+ timeout: typing.Optional[float] = None,
+ force: typing.Optional[bool] = None,
+ no_wait_after: typing.Optional[bool] = None,
+ trial: typing.Optional[bool] = None
) -> NoneType:
"""ElementHandle.dblclick
@@ -1889,14 +1907,16 @@ async def dblclick(
async def select_option(
self,
- value: typing.Union[str, typing.List[str]] = None,
+ value: typing.Optional[typing.Union[str, typing.List[str]]] = None,
*,
- index: typing.Union[int, typing.List[int]] = None,
- label: typing.Union[str, typing.List[str]] = None,
- element: typing.Union["ElementHandle", typing.List["ElementHandle"]] = None,
- timeout: float = None,
- force: bool = None,
- no_wait_after: bool = None
+ index: typing.Optional[typing.Union[int, typing.List[int]]] = None,
+ label: typing.Optional[typing.Union[str, typing.List[str]]] = None,
+ element: typing.Optional[
+ typing.Union["ElementHandle", typing.List["ElementHandle"]]
+ ] = None,
+ timeout: typing.Optional[float] = None,
+ force: typing.Optional[bool] = None,
+ no_wait_after: typing.Optional[bool] = None
) -> typing.List[str]:
"""ElementHandle.select_option
@@ -1965,11 +1985,11 @@ async def tap(
modifiers: typing.Optional[
typing.List[Literal["Alt", "Control", "Meta", "Shift"]]
] = None,
- position: Position = None,
- timeout: float = None,
- force: bool = None,
- no_wait_after: bool = None,
- trial: bool = None
+ position: typing.Optional[Position] = None,
+ timeout: typing.Optional[float] = None,
+ force: typing.Optional[bool] = None,
+ no_wait_after: typing.Optional[bool] = None,
+ trial: typing.Optional[bool] = None
) -> NoneType:
"""ElementHandle.tap
@@ -2023,9 +2043,9 @@ async def fill(
self,
value: str,
*,
- timeout: float = None,
- no_wait_after: bool = None,
- force: bool = None
+ timeout: typing.Optional[float] = None,
+ no_wait_after: typing.Optional[bool] = None,
+ force: typing.Optional[bool] = None
) -> NoneType:
"""ElementHandle.fill
@@ -2061,7 +2081,10 @@ async def fill(
)
async def select_text(
- self, *, force: bool = None, timeout: float = None
+ self,
+ *,
+ force: typing.Optional[bool] = None,
+ timeout: typing.Optional[float] = None
) -> NoneType:
"""ElementHandle.select_text
@@ -2085,7 +2108,7 @@ async def select_text(
await self._impl_obj.select_text(force=force, timeout=timeout)
)
- async def input_value(self, *, timeout: float = None) -> str:
+ async def input_value(self, *, timeout: typing.Optional[float] = None) -> str:
"""ElementHandle.input_value
Returns `input.value` for the selected `` or `