Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | List of all members
playwright.sync_api._generated.Page Class Reference
Inheritance diagram for playwright.sync_api._generated.Page:
Inheritance graph
[legend]
Collaboration diagram for playwright.sync_api._generated.Page:
Collaboration graph
[legend]

Public Member Functions

None on (self, Literal["close"] event, typing.Callable[["Page"], "None"] f)
 
None on (self, Literal["console"] event, typing.Callable[["ConsoleMessage"], "None"] f)
 
None on (self, Literal["crash"] event, typing.Callable[["Page"], "None"] f)
 
None on (self, Literal["dialog"] event, typing.Callable[["Dialog"], "None"] f)
 
None on (self, Literal["domcontentloaded"] event, typing.Callable[["Page"], "None"] f)
 
None on (self, Literal["download"] event, typing.Callable[["Download"], "None"] f)
 
None on (self, Literal["filechooser"] event, typing.Callable[["FileChooser"], "None"] f)
 
None on (self, Literal["frameattached"] event, typing.Callable[["Frame"], "None"] f)
 
None on (self, Literal["framedetached"] event, typing.Callable[["Frame"], "None"] f)
 
None on (self, Literal["framenavigated"] event, typing.Callable[["Frame"], "None"] f)
 
None on (self, Literal["load"] event, typing.Callable[["Page"], "None"] f)
 
None on (self, Literal["pageerror"] event, typing.Callable[["Error"], "None"] f)
 
None on (self, Literal["popup"] event, typing.Callable[["Page"], "None"] f)
 
None on (self, Literal["request"] event, typing.Callable[["Request"], "None"] f)
 
None on (self, Literal["requestfailed"] event, typing.Callable[["Request"], "None"] f)
 
None on (self, Literal["requestfinished"] event, typing.Callable[["Request"], "None"] f)
 
None on (self, Literal["response"] event, typing.Callable[["Response"], "None"] f)
 
None on (self, Literal["websocket"] event, typing.Callable[["WebSocket"], "None"] f)
 
None on (self, Literal["worker"] event, typing.Callable[["Worker"], "None"] f)
 
None on (self, str event, typing.Callable[..., None] f)
 
None once (self, Literal["close"] event, typing.Callable[["Page"], "None"] f)
 
None once (self, Literal["console"] event, typing.Callable[["ConsoleMessage"], "None"] f)
 
None once (self, Literal["crash"] event, typing.Callable[["Page"], "None"] f)
 
None once (self, Literal["dialog"] event, typing.Callable[["Dialog"], "None"] f)
 
None once (self, Literal["domcontentloaded"] event, typing.Callable[["Page"], "None"] f)
 
None once (self, Literal["download"] event, typing.Callable[["Download"], "None"] f)
 
None once (self, Literal["filechooser"] event, typing.Callable[["FileChooser"], "None"] f)
 
None once (self, Literal["frameattached"] event, typing.Callable[["Frame"], "None"] f)
 
None once (self, Literal["framedetached"] event, typing.Callable[["Frame"], "None"] f)
 
None once (self, Literal["framenavigated"] event, typing.Callable[["Frame"], "None"] f)
 
None once (self, Literal["load"] event, typing.Callable[["Page"], "None"] f)
 
None once (self, Literal["pageerror"] event, typing.Callable[["Error"], "None"] f)
 
None once (self, Literal["popup"] event, typing.Callable[["Page"], "None"] f)
 
None once (self, Literal["request"] event, typing.Callable[["Request"], "None"] f)
 
None once (self, Literal["requestfailed"] event, typing.Callable[["Request"], "None"] f)
 
None once (self, Literal["requestfinished"] event, typing.Callable[["Request"], "None"] f)
 
None once (self, Literal["response"] event, typing.Callable[["Response"], "None"] f)
 
None once (self, Literal["websocket"] event, typing.Callable[["WebSocket"], "None"] f)
 
None once (self, Literal["worker"] event, typing.Callable[["Worker"], "None"] f)
 
None once (self, str event, typing.Callable[..., None] f)
 
"Keyboard" keyboard (self)
 
"Mouse" mouse (self)
 
"Touchscreen" touchscreen (self)
 
"BrowserContext" context (self)
 
"Clock" clock (self)
 
"Frame" main_frame (self)
 
typing.List["Frame"] frames (self)
 
str url (self)
 
typing.Optional[ViewportSizeviewport_size (self)
 
typing.List["Worker"] workers (self)
 
"APIRequestContext" request (self)
 
typing.Optional["Video"] video (self)
 
typing.Optional["Page"] opener (self)
 
typing.Optional["Frame"] frame (self, typing.Optional[str] name=None, *typing.Optional[typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]]] url=None)
 
None set_default_navigation_timeout (self, float timeout)
 
None set_default_timeout (self, float timeout)
 
typing.Optional["ElementHandle"] query_selector (self, str selector, *typing.Optional[bool] strict=None)
 
typing.List["ElementHandle"] query_selector_all (self, str selector)
 
typing.Optional["ElementHandle"] wait_for_selector (self, str selector, *typing.Optional[float] timeout=None, typing.Optional[Literal["attached", "detached", "hidden", "visible"]] state=None, typing.Optional[bool] strict=None)
 
bool is_checked (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
bool is_disabled (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
bool is_editable (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
bool is_enabled (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
bool is_hidden (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
bool is_visible (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
None dispatch_event (self, str selector, str type, typing.Optional[typing.Dict] event_init=None, *typing.Optional[float] timeout=None, typing.Optional[bool] strict=None)
 
typing.Any evaluate (self, str expression, typing.Optional[typing.Any] arg=None)
 
"JSHandle" evaluate_handle (self, str expression, typing.Optional[typing.Any] arg=None)
 
typing.Any eval_on_selector (self, str selector, str expression, typing.Optional[typing.Any] arg=None, *typing.Optional[bool] strict=None)
 
typing.Any eval_on_selector_all (self, str selector, str expression, typing.Optional[typing.Any] arg=None)
 
"ElementHandle" add_script_tag (self, *typing.Optional[str] url=None, typing.Optional[typing.Union[pathlib.Path, str]] path=None, typing.Optional[str] content=None, typing.Optional[str] type=None)
 
"ElementHandle" add_style_tag (self, *typing.Optional[str] url=None, typing.Optional[typing.Union[pathlib.Path, str]] path=None, typing.Optional[str] content=None)
 
None expose_function (self, str name, typing.Callable callback)
 
None expose_binding (self, str name, typing.Callable callback, *typing.Optional[bool] handle=None)
 
None set_extra_http_headers (self, typing.Dict[str, str] headers)
 
str content (self)
 
None set_content (self, str html, *typing.Optional[float] timeout=None, typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None)
 
typing.Optional["Response"] goto (self, str url, *typing.Optional[float] timeout=None, typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None, typing.Optional[str] referer=None)
 
typing.Optional["Response"] reload (self, *typing.Optional[float] timeout=None, typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None)
 
None wait_for_load_state (self, typing.Optional[Literal["domcontentloaded", "load", "networkidle"]] state=None, *typing.Optional[float] timeout=None)
 
None wait_for_url (self, typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]] url, *typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None, typing.Optional[float] timeout=None)
 
typing.Any wait_for_event (self, str event, typing.Optional[typing.Callable] predicate=None, *typing.Optional[float] timeout=None)
 
typing.Optional["Response"] go_back (self, *typing.Optional[float] timeout=None, typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None)
 
typing.Optional["Response"] go_forward (self, *typing.Optional[float] timeout=None, typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None)
 
None request_gc (self)
 
None emulate_media (self, *typing.Optional[Literal["null", "print", "screen"]] media=None, typing.Optional[Literal["dark", "light", "no-preference", "null"]] color_scheme=None, typing.Optional[Literal["no-preference", "null", "reduce"]] reduced_motion=None, typing.Optional[Literal["active", "none", "null"]] forced_colors=None, typing.Optional[Literal["more", "no-preference", "null"]] contrast=None)
 
None set_viewport_size (self, ViewportSize viewport_size)
 
None bring_to_front (self)
 
None add_init_script (self, typing.Optional[str] script=None, *typing.Optional[typing.Union[pathlib.Path, str]] path=None)
 
None route (self, typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]] url, typing.Union[typing.Callable[["Route"], typing.Any], typing.Callable[["Route", "Request"], typing.Any],] handler, *typing.Optional[int] times=None)
 
None unroute (self, typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]] url, typing.Optional[typing.Union[typing.Callable[["Route"], typing.Any], typing.Callable[["Route", "Request"], typing.Any],]] handler=None)
 
None route_web_socket (self, typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]] url, typing.Callable[["WebSocketRoute"], typing.Any] handler)
 
None unroute_all (self, *typing.Optional[Literal["default", "ignoreErrors", "wait"]] behavior=None)
 
None route_from_har (self, typing.Union[pathlib.Path, str] har, *typing.Optional[typing.Union[typing.Pattern[str], str]] url=None, typing.Optional[Literal["abort", "fallback"]] not_found=None, typing.Optional[bool] update=None, typing.Optional[Literal["attach", "embed"]] update_content=None, typing.Optional[Literal["full", "minimal"]] update_mode=None)
 
bytes screenshot (self, *typing.Optional[float] timeout=None, typing.Optional[Literal["jpeg", "png"]] type=None, typing.Optional[typing.Union[pathlib.Path, str]] path=None, typing.Optional[int] quality=None, typing.Optional[bool] omit_background=None, typing.Optional[bool] full_page=None, typing.Optional[FloatRect] clip=None, typing.Optional[Literal["allow", "disabled"]] animations=None, typing.Optional[Literal["hide", "initial"]] caret=None, typing.Optional[Literal["css", "device"]] scale=None, typing.Optional[typing.Sequence["Locator"]] mask=None, typing.Optional[str] mask_color=None, typing.Optional[str] style=None)
 
str title (self)
 
None close (self, *typing.Optional[bool] run_before_unload=None, typing.Optional[str] reason=None)
 
bool is_closed (self)
 
None click (self, str selector, *typing.Optional[typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]] modifiers=None, typing.Optional[Position] position=None, typing.Optional[float] delay=None, typing.Optional[Literal["left", "middle", "right"]] button=None, typing.Optional[int] click_count=None, typing.Optional[float] timeout=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] trial=None, typing.Optional[bool] strict=None)
 
None dblclick (self, str selector, *typing.Optional[typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]] modifiers=None, typing.Optional[Position] position=None, typing.Optional[float] delay=None, typing.Optional[Literal["left", "middle", "right"]] button=None, typing.Optional[float] timeout=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None)
 
None tap (self, str selector, *typing.Optional[typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]] modifiers=None, typing.Optional[Position] position=None, typing.Optional[float] timeout=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None)
 
None fill (self, str selector, str value, *typing.Optional[float] timeout=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None, typing.Optional[bool] force=None)
 
"Locator" locator (self, str selector, *typing.Optional[typing.Union[typing.Pattern[str], str]] has_text=None, typing.Optional[typing.Union[typing.Pattern[str], str]] has_not_text=None, typing.Optional["Locator"] has=None, typing.Optional["Locator"] has_not=None)
 
"Locator" get_by_alt_text (self, typing.Union[str, typing.Pattern[str]] text, *typing.Optional[bool] exact=None)
 
"Locator" get_by_label (self, typing.Union[str, typing.Pattern[str]] text, *typing.Optional[bool] exact=None)
 
"Locator" get_by_placeholder (self, typing.Union[str, typing.Pattern[str]] text, *typing.Optional[bool] exact=None)
 
"Locator" get_by_role (self, Literal["alert", "alertdialog", "application", "article", "banner", "blockquote", "button", "caption", "cell", "checkbox", "code", "columnheader", "combobox", "complementary", "contentinfo", "definition", "deletion", "dialog", "directory", "document", "emphasis", "feed", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "insertion", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "strong", "subscript", "superscript", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "time", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem",] role, *typing.Optional[bool] checked=None, typing.Optional[bool] disabled=None, typing.Optional[bool] expanded=None, typing.Optional[bool] include_hidden=None, typing.Optional[int] level=None, typing.Optional[typing.Union[typing.Pattern[str], str]] name=None, typing.Optional[bool] pressed=None, typing.Optional[bool] selected=None, typing.Optional[bool] exact=None)
 
"Locator" get_by_test_id (self, typing.Union[str, typing.Pattern[str]] test_id)
 
"Locator" get_by_text (self, typing.Union[str, typing.Pattern[str]] text, *typing.Optional[bool] exact=None)
 
"Locator" get_by_title (self, typing.Union[str, typing.Pattern[str]] text, *typing.Optional[bool] exact=None)
 
"FrameLocator" frame_locator (self, str selector)
 
None focus (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
typing.Optional[str] text_content (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
str inner_text (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
str inner_html (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
typing.Optional[str] get_attribute (self, str selector, str name, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
None hover (self, str selector, *typing.Optional[typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]] modifiers=None, typing.Optional[Position] position=None, typing.Optional[float] timeout=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] force=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None)
 
None drag_and_drop (self, str source, str target, *typing.Optional[Position] source_position=None, typing.Optional[Position] target_position=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[float] timeout=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None, typing.Optional[int] steps=None)
 
typing.List[str] select_option (self, str selector, typing.Optional[typing.Union[str, typing.Sequence[str]]] value=None, *typing.Optional[typing.Union[int, typing.Sequence[int]]] index=None, typing.Optional[typing.Union[str, typing.Sequence[str]]] label=None, typing.Optional[typing.Union["ElementHandle", typing.Sequence["ElementHandle"]]] element=None, typing.Optional[float] timeout=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] force=None, typing.Optional[bool] strict=None)
 
str input_value (self, str selector, *typing.Optional[bool] strict=None, typing.Optional[float] timeout=None)
 
None set_input_files (self, str selector, typing.Union[str, pathlib.Path, FilePayload, typing.Sequence[typing.Union[str, pathlib.Path]], typing.Sequence[FilePayload],] files, *typing.Optional[float] timeout=None, typing.Optional[bool] strict=None, typing.Optional[bool] no_wait_after=None)
 
None type (self, str selector, str text, *typing.Optional[float] delay=None, typing.Optional[float] timeout=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None)
 
None press (self, str selector, str key, *typing.Optional[float] delay=None, typing.Optional[float] timeout=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None)
 
None check (self, str selector, *typing.Optional[Position] position=None, typing.Optional[float] timeout=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None)
 
None uncheck (self, str selector, *typing.Optional[Position] position=None, typing.Optional[float] timeout=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None)
 
None wait_for_timeout (self, float timeout)
 
"JSHandle" wait_for_function (self, str expression, *typing.Optional[typing.Any] arg=None, typing.Optional[float] timeout=None, typing.Optional[typing.Union[float, Literal["raf"]]] polling=None)
 
None pause (self)
 
bytes pdf (self, *typing.Optional[float] scale=None, typing.Optional[bool] display_header_footer=None, typing.Optional[str] header_template=None, typing.Optional[str] footer_template=None, typing.Optional[bool] print_background=None, typing.Optional[bool] landscape=None, typing.Optional[str] page_ranges=None, typing.Optional[str] format=None, typing.Optional[typing.Union[str, float]] width=None, typing.Optional[typing.Union[str, float]] height=None, typing.Optional[bool] prefer_css_page_size=None, typing.Optional[PdfMargins] margin=None, typing.Optional[typing.Union[pathlib.Path, str]] path=None, typing.Optional[bool] outline=None, typing.Optional[bool] tagged=None)
 
EventContextManager expect_event (self, str event, typing.Optional[typing.Callable] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["ConsoleMessage"] expect_console_message (self, typing.Optional[typing.Callable[["ConsoleMessage"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["Download"] expect_download (self, typing.Optional[typing.Callable[["Download"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["FileChooser"] expect_file_chooser (self, typing.Optional[typing.Callable[["FileChooser"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["Response"] expect_navigation (self, *typing.Optional[typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]]] url=None, typing.Optional[Literal["commit", "domcontentloaded", "load", "networkidle"]] wait_until=None, typing.Optional[float] timeout=None)
 
EventContextManager["Page"] expect_popup (self, typing.Optional[typing.Callable[["Page"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["Request"] expect_request (self, typing.Union[str, typing.Pattern[str], typing.Callable[["Request"], bool]] url_or_predicate, *typing.Optional[float] timeout=None)
 
EventContextManager["Request"] expect_request_finished (self, typing.Optional[typing.Callable[["Request"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["Response"] expect_response (self, typing.Union[str, typing.Pattern[str], typing.Callable[["Response"], bool]] url_or_predicate, *typing.Optional[float] timeout=None)
 
EventContextManager["WebSocket"] expect_websocket (self, typing.Optional[typing.Callable[["WebSocket"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
EventContextManager["Worker"] expect_worker (self, typing.Optional[typing.Callable[["Worker"], bool]] predicate=None, *typing.Optional[float] timeout=None)
 
None set_checked (self, str selector, bool checked, *typing.Optional[Position] position=None, typing.Optional[float] timeout=None, typing.Optional[bool] force=None, typing.Optional[bool] no_wait_after=None, typing.Optional[bool] strict=None, typing.Optional[bool] trial=None)
 
None add_locator_handler (self, "Locator" locator, typing.Union[typing.Callable[["Locator"], typing.Any], typing.Callable[[], typing.Any]] handler, *typing.Optional[bool] no_wait_after=None, typing.Optional[int] times=None)
 
None remove_locator_handler (self, "Locator" locator)
 
typing.List["Request"] requests (self)
 
typing.List["ConsoleMessage"] console_messages (self)
 
typing.List["Error"] page_errors (self)
 
- Public Member Functions inherited from playwright._impl._sync_base.SyncContextManager
Self __enter__ (Self self)
 
None __exit__ (self, Optional[Type[BaseException]] exc_type, Optional[BaseException] exc_val, Optional[TracebackType] _traceback)
 
- Public Member Functions inherited from playwright._impl._sync_base.SyncBase
None __init__ (self, Any impl_obj)
 
str __str__ (self)
 
None remove_listener (self, Any event, Any f)
 
- Public Member Functions inherited from playwright._impl._impl_to_api_mapping.ImplWrapper
str __repr__ (self)
 

Additional Inherited Members

- Protected Member Functions inherited from playwright._impl._sync_base.SyncBase
Any _sync (self, Union[Coroutine[Any, Any, Any], Generator[Any, Any, Any]] coro)
 
Callable[..., None] _wrap_handler (self, Union[Callable[..., Any], Any] handler)
 
- Protected Attributes inherited from playwright._impl._sync_base.SyncBase
 _dispatcher_fiber
 
 _loop
 
- Protected Attributes inherited from playwright._impl._impl_to_api_mapping.ImplWrapper
 _impl_obj
 

Member Function Documentation

◆ add_init_script()

None playwright.sync_api._generated.Page.add_init_script (   self,
typing.Optional[str]   script = None,
*typing.Optional[typing.Union[pathlib.Path, str]]   path = None 
)
Page.add_init_script

Adds a script which would be evaluated in one of the following scenarios:
- Whenever the page is navigated.
- Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the
  newly attached frame.

The script is evaluated after the document was created but before any of its scripts were run. This is useful to
amend the JavaScript environment, e.g. to seed `Math.random`.

**Usage**

An example of overriding `Math.random` before the page loads:

```py
# in your playwright script, assuming the preload.js file is in same directory
page.add_init_script(path=\"./preload.js\")
```

**NOTE** The order of evaluation of multiple scripts installed via `browser_context.add_init_script()` and
`page.add_init_script()` is not defined.

Parameters
----------
script : Union[str, None]
    Script to be evaluated in all pages in the browser context. Optional.
path : Union[pathlib.Path, str, None]
    Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working
    directory. Optional.

◆ add_locator_handler()

None playwright.sync_api._generated.Page.add_locator_handler (   self,
"Locator"  locator,
typing.Union[ typing.Callable[["Locator"], typing.Any], typing.Callable[[], typing.Any] ]  handler,
*typing.Optional[bool]   no_wait_after = None,
typing.Optional[int]   times = None 
)
Page.add_locator_handler

When testing a web page, sometimes unexpected overlays like a \"Sign up\" dialog appear and block actions you want to
automate, e.g. clicking a button. These overlays don't always show up in the same way or at the same time, making
them tricky to handle in automated tests.

This method lets you set up a special function, called a handler, that activates when it detects that overlay is
visible. The handler's job is to remove the overlay, allowing your test to continue as if the overlay wasn't there.

Things to keep in mind:
- When an overlay is shown predictably, we recommend explicitly waiting for it in your test and dismissing it as
  a part of your normal test flow, instead of using `page.add_locator_handler()`.
- Playwright checks for the overlay every time before executing or retrying an action that requires an
  [actionability check](https://playwright.dev/python/docs/actionability), or before performing an auto-waiting assertion check. When overlay
  is visible, Playwright calls the handler first, and then proceeds with the action/assertion. Note that the
  handler is only called when you perform an action/assertion - if the overlay becomes visible but you don't
  perform any actions, the handler will not be triggered.
- After executing the handler, Playwright will ensure that overlay that triggered the handler is not visible
  anymore. You can opt-out of this behavior with `noWaitAfter`.
- The execution time of the handler counts towards the timeout of the action/assertion that executed the handler.
  If your handler takes too long, it might cause timeouts.
- You can register multiple handlers. However, only a single handler will be running at a time. Make sure the
  actions within a handler don't depend on another handler.

**NOTE** Running the handler will alter your page state mid-test. For example it will change the currently focused
element and move the mouse. Make sure that actions that run after the handler are self-contained and do not rely on
the focus and mouse state being unchanged.

For example, consider a test that calls `locator.focus()` followed by `keyboard.press()`. If your
handler clicks a button between these two actions, the focused element most likely will be wrong, and key press
will happen on the unexpected element. Use `locator.press()` instead to avoid this problem.

Another example is a series of mouse actions, where `mouse.move()` is followed by `mouse.down()`.
Again, when the handler runs between these two actions, the mouse position will be wrong during the mouse down.
Prefer self-contained actions like `locator.click()` that do not rely on the state being unchanged by a
handler.

**Usage**

An example that closes a \"Sign up to the newsletter\" dialog when it appears:

```py
# Setup the handler.
async def handler():
  await page.get_by_role(\"button\", name=\"No thanks\").click()
await page.add_locator_handler(page.get_by_text(\"Sign up to the newsletter\"), handler)

# Write the test as usual.
await page.goto(\"https://example.com\")
await page.get_by_role(\"button\", name=\"Start here\").click()
```

An example that skips the \"Confirm your security details\" page when it is shown:

```py
# Setup the handler.
async def handler():
  await page.get_by_role(\"button\", name=\"Remind me later\").click()
await page.add_locator_handler(page.get_by_text(\"Confirm your security details\"), handler)

# Write the test as usual.
await page.goto(\"https://example.com\")
await page.get_by_role(\"button\", name=\"Start here\").click()
```

An example with a custom callback on every actionability check. It uses a `<body>` locator that is always visible,
so the handler is called before every actionability check. It is important to specify `noWaitAfter`, because the
handler does not hide the `<body>` element.

```py
# Setup the handler.
async def handler():
  await page.evaluate(\"window.removeObstructionsForTestIfNeeded()\")
await page.add_locator_handler(page.locator(\"body\"), handler, no_wait_after=True)

# Write the test as usual.
await page.goto(\"https://example.com\")
await page.get_by_role(\"button\", name=\"Start here\").click()
```

Handler takes the original locator as an argument. You can also automatically remove the handler after a number of
invocations by setting `times`:

```py
async def handler(locator):
  await locator.click()
await page.add_locator_handler(page.get_by_label(\"Close\"), handler, times=1)
```

Parameters
----------
locator : Locator
    Locator that triggers the handler.
handler : Union[Callable[[Locator], Any], Callable[[], Any]]
    Function that should be run once `locator` appears. This function should get rid of the element that blocks actions
    like click.
no_wait_after : Union[bool, None]
    By default, after calling the handler Playwright will wait until the overlay becomes hidden, and only then
    Playwright will continue with the action/assertion that triggered the handler. This option allows to opt-out of
    this behavior, so that overlay can stay visible after the handler has run.
times : Union[int, None]
    Specifies the maximum number of times this handler should be called. Unlimited by default.

◆ add_script_tag()

"ElementHandle" playwright.sync_api._generated.Page.add_script_tag (   self,
*typing.Optional[str]   url = None,
typing.Optional[typing.Union[pathlib.Path, str]]   path = None,
typing.Optional[str]   content = None,
typing.Optional[str]   type = None 
)
Page.add_script_tag

Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload
fires or when the script content was injected into frame.

Parameters
----------
url : Union[str, None]
    URL of a script to be added.
path : Union[pathlib.Path, str, None]
    Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative
    to the current working directory.
content : Union[str, None]
    Raw JavaScript content to be injected into frame.
type : Union[str, None]
    Script type. Use 'module' in order to load a JavaScript ES6 module. See
    [script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for more details.

Returns
-------
ElementHandle

◆ add_style_tag()

"ElementHandle" playwright.sync_api._generated.Page.add_style_tag (   self,
*typing.Optional[str]   url = None,
typing.Optional[typing.Union[pathlib.Path, str]]   path = None,
typing.Optional[str]   content = None 
)
Page.add_style_tag

Adds a `<link rel=\"stylesheet\">` tag into the page with the desired url or a `<style type=\"text/css\">` tag with the
content. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.

Parameters
----------
url : Union[str, None]
    URL of the `<link>` tag.
path : Union[pathlib.Path, str, None]
    Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the
    current working directory.
content : Union[str, None]
    Raw CSS content to be injected into frame.

Returns
-------
ElementHandle

◆ bring_to_front()

None playwright.sync_api._generated.Page.bring_to_front (   self)
Page.bring_to_front

Brings page to front (activates tab).

◆ check()

None playwright.sync_api._generated.Page.check (   self,
str  selector,
*typing.Optional[Position]   position = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None 
)
Page.check

This method checks an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is
   already checked, this method returns immediately.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.mouse` to click in the center of the element.
1. Ensure that the element is now checked. If not, this method throws.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it.

◆ click()

None playwright.sync_api._generated.Page.click (   self,
str  selector,
*typing.Optional[ typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]] ]   modifiers = None,
typing.Optional[Position]   position = None,
typing.Optional[float]   delay = None,
typing.Optional[Literal["left", "middle", "right"]]   button = None,
typing.Optional[int]   click_count = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   trial = None,
typing.Optional[bool]   strict = None 
)
Page.click

This method clicks an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.mouse` to click in the center of the element, or the specified `position`.
1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
    Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
    current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
    "Control" on Windows and Linux and to "Meta" on macOS.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
delay : Union[float, None]
    Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
button : Union["left", "middle", "right", None]
    Defaults to `left`.
click_count : Union[int, None]
    defaults to 1. See [UIEvent.detail].
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
    can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
    navigating to inaccessible pages. Defaults to `false`.
    Deprecated: This option will default to `true` in the future.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
    `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
    are pressed.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

◆ clock()

"Clock" playwright.sync_api._generated.Page.clock (   self)
Page.clock

Playwright has ability to mock clock and passage of time.

Returns
-------
Clock

◆ close()

None playwright.sync_api._generated.Page.close (   self,
*typing.Optional[bool]   run_before_unload = None,
typing.Optional[str]   reason = None 
)
Page.close

If `runBeforeUnload` is `false`, does not run any unload handlers and waits for the page to be closed. If
`runBeforeUnload` is `true` the method will run unload handlers, but will **not** wait for the page to close.

By default, `page.close()` **does not** run `beforeunload` handlers.

**NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned and should be handled
manually via `page.on('dialog')` event.

Parameters
----------
run_before_unload : Union[bool, None]
    Defaults to `false`. Whether to run the
    [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.
reason : Union[str, None]
    The reason to be reported to the operations interrupted by the page closure.

Reimplemented from playwright._impl._sync_base.SyncContextManager.

◆ console_messages()

typing.List["ConsoleMessage"] playwright.sync_api._generated.Page.console_messages (   self)
Page.console_messages

Returns up to (currently) 200 last console messages from this page. See `page.on('console')` for more details.

Returns
-------
List[ConsoleMessage]

◆ content()

str playwright.sync_api._generated.Page.content (   self)
Page.content

Gets the full HTML contents of the page, including the doctype.

Returns
-------
str

◆ context()

"BrowserContext" playwright.sync_api._generated.Page.context (   self)
Page.context

Get the browser context that the page belongs to.

Returns
-------
BrowserContext

◆ dblclick()

None playwright.sync_api._generated.Page.dblclick (   self,
str  selector,
*typing.Optional[ typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]] ]   modifiers = None,
typing.Optional[Position]   position = None,
typing.Optional[float]   delay = None,
typing.Optional[Literal["left", "middle", "right"]]   button = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None 
)
Page.dblclick

This method double clicks an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.mouse` to double click in the center of the element, or the specified `position`.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

**NOTE** `page.dblclick()` dispatches two `click` events and a single `dblclick` event.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
    Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
    current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
    "Control" on Windows and Linux and to "Meta" on macOS.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
delay : Union[float, None]
    Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
button : Union["left", "middle", "right", None]
    Defaults to `left`.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
    `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
    are pressed.

◆ dispatch_event()

None playwright.sync_api._generated.Page.dispatch_event (   self,
str  selector,
str  type,
typing.Optional[typing.Dict]   event_init = None,
*typing.Optional[float]   timeout = None,
typing.Optional[bool]   strict = None 
)
Page.dispatch_event

The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element,
`click` is dispatched. This is equivalent to calling
[element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).

**Usage**

```py
page.dispatch_event(\"button#submit\", \"click\")
```

Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit`
properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default.

Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties:
- [DeviceMotionEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent)
- [DeviceOrientationEvent](https://developer.mozilla.org/en-US/docs/Web/API/DeviceOrientationEvent/DeviceOrientationEvent)
- [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
- [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
- [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
- [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
- [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
- [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
- [WheelEvent](https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent)

You can also specify `JSHandle` as the property value if you want live objects to be passed into the event:

```py
# note you can only create data_transfer in chromium and firefox
data_transfer = page.evaluate_handle(\"new DataTransfer()\")
page.dispatch_event(\"#source\", \"dragstart\", { \"dataTransfer\": data_transfer })
```

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
type : str
    DOM event type: `"click"`, `"dragstart"`, etc.
event_init : Union[Dict, None]
    Optional event-specific initialization properties.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

◆ drag_and_drop()

None playwright.sync_api._generated.Page.drag_and_drop (   self,
str  source,
str  target,
*typing.Optional[Position]   source_position = None,
typing.Optional[Position]   target_position = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None,
typing.Optional[int]   steps = None 
)
Page.drag_and_drop

This method drags the source element to the target element. It will first move to the source element, perform a
`mousedown`, then move to the target element and perform a `mouseup`.

**Usage**

```py
page.drag_and_drop(\"#source\", \"#target\")
# or specify exact positions relative to the top-left corners of the elements:
page.drag_and_drop(
  \"#source\",
  \"#target\",
  source_position={\"x\": 34, \"y\": 7},
  target_position={\"x\": 10, \"y\": 20}
)
```

Parameters
----------
source : str
    A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will
    be used.
target : str
    A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first
    will be used.
source_position : Union[{x: float, y: float}, None]
    Clicks on the source element at this point relative to the top-left corner of the element's padding box. If not
    specified, some visible point of the element is used.
target_position : Union[{x: float, y: float}, None]
    Drops on the target element at this point relative to the top-left corner of the element's padding box. If not
    specified, some visible point of the element is used.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it.
steps : Union[int, None]
    Defaults to 1. Sends `n` interpolated `mousemove` events to represent travel between the `mousedown` and `mouseup`
    of the drag. When set to 1, emits a single `mousemove` event at the destination location.

◆ emulate_media()

None playwright.sync_api._generated.Page.emulate_media (   self,
*typing.Optional[Literal["null", "print", "screen"]]   media = None,
typing.Optional[ Literal["dark", "light", "no-preference", "null"] ]   color_scheme = None,
typing.Optional[ Literal["no-preference", "null", "reduce"] ]   reduced_motion = None,
typing.Optional[Literal["active", "none", "null"]]   forced_colors = None,
typing.Optional[Literal["more", "no-preference", "null"]]   contrast = None 
)
Page.emulate_media

This method changes the `CSS media type` through the `media` argument, and/or the `'prefers-colors-scheme'` media
feature, using the `colorScheme` argument.

**Usage**

```py
page.evaluate(\"matchMedia('screen').matches\")
# → True
page.evaluate(\"matchMedia('print').matches\")
# → False

page.emulate_media(media=\"print\")
page.evaluate(\"matchMedia('screen').matches\")
# → False
page.evaluate(\"matchMedia('print').matches\")
# → True

page.emulate_media()
page.evaluate(\"matchMedia('screen').matches\")
# → True
page.evaluate(\"matchMedia('print').matches\")
# → False
```

```py
page.emulate_media(color_scheme=\"dark\")
page.evaluate(\"matchMedia('(prefers-color-scheme: dark)').matches\")
# → True
page.evaluate(\"matchMedia('(prefers-color-scheme: light)').matches\")
# → False
```

Parameters
----------
media : Union["null", "print", "screen", None]
    Changes the CSS media type of the page. The only allowed values are `'Screen'`, `'Print'` and `'Null'`. Passing
    `'Null'` disables CSS media emulation.
color_scheme : Union["dark", "light", "no-preference", "null", None]
    Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
    media feature, supported values are `'light'` and `'dark'`. Passing `'Null'` disables color scheme emulation.
    `'no-preference'` is deprecated.
reduced_motion : Union["no-preference", "null", "reduce", None]
    Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. Passing
    `null` disables reduced motion emulation.
forced_colors : Union["active", "none", "null", None]
contrast : Union["more", "no-preference", "null", None]

◆ eval_on_selector()

typing.Any playwright.sync_api._generated.Page.eval_on_selector (   self,
str  selector,
str  expression,
typing.Optional[typing.Any]   arg = None,
*typing.Optional[bool]   strict = None 
)
Page.eval_on_selector

The method finds an element matching the specified selector within the page and passes it as a first argument to
`expression`. If no elements match the selector, the method throws an error. Returns the value of `expression`.

If `expression` returns a [Promise], then `page.eval_on_selector()` would wait for the promise to resolve and
return its value.

**Usage**

```py
search_value = page.eval_on_selector(\"#search\", \"el => el.value\")
preload_href = page.eval_on_selector(\"link[rel=preload]\", \"el => el.href\")
html = page.eval_on_selector(\".main-container\", \"(e, suffix) => e.outer_html + suffix\", \"hello\")
```

Parameters
----------
selector : str
    A selector to query for.
expression : str
    JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the
    function is automatically invoked.
arg : Union[Any, None]
    Optional argument to pass to `expression`.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

Returns
-------
Any

◆ eval_on_selector_all()

typing.Any playwright.sync_api._generated.Page.eval_on_selector_all (   self,
str  selector,
str  expression,
typing.Optional[typing.Any]   arg = None 
)
Page.eval_on_selector_all

The method finds all elements matching the specified selector within the page and passes an array of matched
elements as a first argument to `expression`. Returns the result of `expression` invocation.

If `expression` returns a [Promise], then `page.eval_on_selector_all()` would wait for the promise to resolve
and return its value.

**Usage**

```py
div_counts = page.eval_on_selector_all(\"div\", \"(divs, min) => divs.length >= min\", 10)
```

Parameters
----------
selector : str
    A selector to query for.
expression : str
    JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the
    function is automatically invoked.
arg : Union[Any, None]
    Optional argument to pass to `expression`.

Returns
-------
Any

◆ evaluate()

typing.Any playwright.sync_api._generated.Page.evaluate (   self,
str  expression,
typing.Optional[typing.Any]   arg = None 
)
Page.evaluate

Returns the value of the `expression` invocation.

If the function passed to the `page.evaluate()` returns a [Promise], then `page.evaluate()` would
wait for the promise to resolve and return its value.

If the function passed to the `page.evaluate()` returns a non-[Serializable] value, then
`page.evaluate()` resolves to `undefined`. Playwright also supports transferring some additional values
that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.

**Usage**

Passing argument to `expression`:

```py
result = page.evaluate(\"([x, y]) => Promise.resolve(x * y)\", [7, 8])
print(result) # prints \"56\"
```

A string can also be passed in instead of a function:

```py
print(page.evaluate(\"1 + 2\")) # prints \"3\"
x = 10
print(page.evaluate(f\"1 + {x}\")) # prints \"11\"
```

`ElementHandle` instances can be passed as an argument to the `page.evaluate()`:

```py
body_handle = page.evaluate(\"document.body\")
html = page.evaluate(\"([body, suffix]) => body.innerHTML + suffix\", [body_handle, \"hello\"])
body_handle.dispose()
```

Parameters
----------
expression : str
    JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the
    function is automatically invoked.
arg : Union[Any, None]
    Optional argument to pass to `expression`.

Returns
-------
Any

◆ evaluate_handle()

"JSHandle" playwright.sync_api._generated.Page.evaluate_handle (   self,
str  expression,
typing.Optional[typing.Any]   arg = None 
)
Page.evaluate_handle

Returns the value of the `expression` invocation as a `JSHandle`.

The only difference between `page.evaluate()` and `page.evaluate_handle()` is that
`page.evaluate_handle()` returns `JSHandle`.

If the function passed to the `page.evaluate_handle()` returns a [Promise], then
`page.evaluate_handle()` would wait for the promise to resolve and return its value.

**Usage**

```py
a_window_handle = page.evaluate_handle(\"Promise.resolve(window)\")
a_window_handle # handle for the window object.
```

A string can also be passed in instead of a function:

```py
a_handle = page.evaluate_handle(\"document\") # handle for the \"document\"
```

`JSHandle` instances can be passed as an argument to the `page.evaluate_handle()`:

```py
a_handle = page.evaluate_handle(\"document.body\")
result_handle = page.evaluate_handle(\"body => body.innerHTML\", a_handle)
print(result_handle.json_value())
result_handle.dispose()
```

Parameters
----------
expression : str
    JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the
    function is automatically invoked.
arg : Union[Any, None]
    Optional argument to pass to `expression`.

Returns
-------
JSHandle

◆ expect_console_message()

EventContextManager["ConsoleMessage"] playwright.sync_api._generated.Page.expect_console_message (   self,
typing.Optional[typing.Callable[["ConsoleMessage"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_console_message

Performs action and waits for a `ConsoleMessage` to be logged by in the page. If predicate is provided, it passes
`ConsoleMessage` value into the `predicate` function and waits for `predicate(message)` to return a truthy value.
Will throw an error if the page is closed before the `page.on('console')` event is fired.

Parameters
----------
predicate : Union[Callable[[ConsoleMessage], bool], None]
    Receives the `ConsoleMessage` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[ConsoleMessage]

◆ expect_download()

EventContextManager["Download"] playwright.sync_api._generated.Page.expect_download (   self,
typing.Optional[typing.Callable[["Download"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_download

Performs action and waits for a new `Download`. If predicate is provided, it passes `Download` value into the
`predicate` function and waits for `predicate(download)` to return a truthy value. Will throw an error if the page
is closed before the download event is fired.

Parameters
----------
predicate : Union[Callable[[Download], bool], None]
    Receives the `Download` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[Download]

◆ expect_event()

EventContextManager playwright.sync_api._generated.Page.expect_event (   self,
str  event,
typing.Optional[typing.Callable]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_event

Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
value. Will throw an error if the page is closed before the event is fired. Returns the event data value.

**Usage**

```py
with page.expect_event(\"framenavigated\") as event_info:
    page.get_by_role(\"button\")
frame = event_info.value
```

Parameters
----------
event : str
    Event name, same one typically passed into `*.on(event)`.
predicate : Union[Callable, None]
    Receives the event data and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager

◆ expect_file_chooser()

EventContextManager["FileChooser"] playwright.sync_api._generated.Page.expect_file_chooser (   self,
typing.Optional[typing.Callable[["FileChooser"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_file_chooser

Performs action and waits for a new `FileChooser` to be created. If predicate is provided, it passes `FileChooser`
value into the `predicate` function and waits for `predicate(fileChooser)` to return a truthy value. Will throw an
error if the page is closed before the file chooser is opened.

Parameters
----------
predicate : Union[Callable[[FileChooser], bool], None]
    Receives the `FileChooser` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[FileChooser]

◆ expect_navigation()

EventContextManager["Response"] playwright.sync_api._generated.Page.expect_navigation (   self,
*typing.Optional[ typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]] ]   url = None,
typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None,
typing.Optional[float]   timeout = None 
)
Page.expect_navigation

Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the
navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or
navigation due to History API usage, the navigation will resolve with `null`.

**Usage**

This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will
indirectly cause the page to navigate. e.g. The click target has an `onclick` handler that triggers navigation from
a `setTimeout`. Consider this example:

```py
with page.expect_navigation():
    # This action triggers the navigation after a timeout.
    page.get_by_text(\"Navigate after timeout\").click()
# Resolves after navigation has finished
```

**NOTE** Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL
is considered a navigation.

Parameters
----------
url : Union[Callable[[str], bool], Pattern[str], str, None]
    A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. Note that if
    the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly
    equal to the string.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.

Returns
-------
EventContextManager[Response]

◆ expect_popup()

EventContextManager["Page"] playwright.sync_api._generated.Page.expect_popup (   self,
typing.Optional[typing.Callable[["Page"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_popup

Performs action and waits for a popup `Page`. If predicate is provided, it passes [Popup] value into the
`predicate` function and waits for `predicate(page)` to return a truthy value. Will throw an error if the page is
closed before the popup event is fired.

Parameters
----------
predicate : Union[Callable[[Page], bool], None]
    Receives the `Page` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[Page]

◆ expect_request()

EventContextManager["Request"] playwright.sync_api._generated.Page.expect_request (   self,
typing.Union[ str, typing.Pattern[str], typing.Callable[["Request"], bool] ]  url_or_predicate,
*typing.Optional[float]   timeout = None 
)
Page.expect_request

Waits for the matching request and returns it. See [waiting for event](https://playwright.dev/python/docs/events#waiting-for-event) for more
details about events.

**Usage**

```py
with page.expect_request(\"http://example.com/resource\") as first:
    page.get_by_text(\"trigger request\").click()
first_request = first.value

# or with a lambda
with page.expect_request(lambda request: request.url == \"http://example.com\" and request.method == \"get\") as second:
    page.get_by_text(\"trigger request\").click()
second_request = second.value
```

Parameters
----------
url_or_predicate : Union[Callable[[Request], bool], Pattern[str], str]
    Request URL string, regex or predicate receiving `Request` object. When a `baseURL` via the context options was
    provided and the passed URL is a path, it gets merged via the
    [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
timeout : Union[float, None]
    Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can
    be changed by using the `page.set_default_timeout()` method.

Returns
-------
EventContextManager[Request]

◆ expect_request_finished()

EventContextManager["Request"] playwright.sync_api._generated.Page.expect_request_finished (   self,
typing.Optional[typing.Callable[["Request"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_request_finished

Performs action and waits for a `Request` to finish loading. If predicate is provided, it passes `Request` value
into the `predicate` function and waits for `predicate(request)` to return a truthy value. Will throw an error if
the page is closed before the `page.on('request_finished')` event is fired.

Parameters
----------
predicate : Union[Callable[[Request], bool], None]
    Receives the `Request` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[Request]

◆ expect_response()

EventContextManager["Response"] playwright.sync_api._generated.Page.expect_response (   self,
typing.Union[ str, typing.Pattern[str], typing.Callable[["Response"], bool] ]  url_or_predicate,
*typing.Optional[float]   timeout = None 
)
Page.expect_response

Returns the matched response. See [waiting for event](https://playwright.dev/python/docs/events#waiting-for-event) for more details about
events.

**Usage**

```py
with page.expect_response(\"https://example.com/resource\") as response_info:
    page.get_by_text(\"trigger response\").click()
response = response_info.value
return response.ok

# or with a lambda
with page.expect_response(lambda response: response.url == \"https://example.com\" and response.status == 200 and response.request.method == \"get\") as response_info:
    page.get_by_text(\"trigger response\").click()
response = response_info.value
return response.ok
```

Parameters
----------
url_or_predicate : Union[Callable[[Response], bool], Pattern[str], str]
    Request URL string, regex or predicate receiving `Response` object. When a `baseURL` via the context options was
    provided and the passed URL is a path, it gets merged via the
    [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
timeout : Union[float, None]
    Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
EventContextManager[Response]

◆ expect_websocket()

EventContextManager["WebSocket"] playwright.sync_api._generated.Page.expect_websocket (   self,
typing.Optional[typing.Callable[["WebSocket"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_websocket

Performs action and waits for a new `WebSocket`. If predicate is provided, it passes `WebSocket` value into the
`predicate` function and waits for `predicate(webSocket)` to return a truthy value. Will throw an error if the page
is closed before the WebSocket event is fired.

Parameters
----------
predicate : Union[Callable[[WebSocket], bool], None]
    Receives the `WebSocket` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[WebSocket]

◆ expect_worker()

EventContextManager["Worker"] playwright.sync_api._generated.Page.expect_worker (   self,
typing.Optional[typing.Callable[["Worker"], bool]]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.expect_worker

Performs action and waits for a new `Worker`. If predicate is provided, it passes `Worker` value into the
`predicate` function and waits for `predicate(worker)` to return a truthy value. Will throw an error if the page is
closed before the worker event is fired.

Parameters
----------
predicate : Union[Callable[[Worker], bool], None]
    Receives the `Worker` object and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
EventContextManager[Worker]

◆ expose_binding()

None playwright.sync_api._generated.Page.expose_binding (   self,
str  name,
typing.Callable  callback,
*typing.Optional[bool]   handle = None 
)
Page.expose_binding

The method adds a function called `name` on the `window` object of every frame in this page. When called, the
function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the
`callback` returns a [Promise], it will be awaited.

The first argument of the `callback` function contains information about the caller: `{ browserContext:
BrowserContext, page: Page, frame: Frame }`.

See `browser_context.expose_binding()` for the context-wide version.

**NOTE** Functions installed via `page.expose_binding()` survive navigations.

**Usage**

An example of exposing page URL to all frames in a page:

```py
from playwright.sync_api import sync_playwright, Playwright

def run(playwright: Playwright):
    webkit = playwright.webkit
    browser = webkit.launch(headless=False)
    context = browser.new_context()
    page = context.new_page()
    page.expose_binding(\"pageURL\", lambda source: source[\"page\"].url)
    page.set_content(\"\"\"
    <script>
      async function onClick() {
        document.querySelector('div').textContent = await window.pageURL();
      }
    </script>
    <button onclick=\"onClick()\">Click me</button>
    <div></div>
    \"\"\")
    page.click(\"button\")

with sync_playwright() as playwright:
    run(playwright)
```

Parameters
----------
name : str
    Name of the function on the window object.
callback : Callable
    Callback function that will be called in the Playwright's context.
handle : Union[bool, None]
    Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
    supported. When passing by value, multiple arguments are supported.
    Deprecated: This option will be removed in the future.

◆ expose_function()

None playwright.sync_api._generated.Page.expose_function (   self,
str  name,
typing.Callable  callback 
)
Page.expose_function

The method adds a function called `name` on the `window` object of every frame in the page. When called, the
function executes `callback` and returns a [Promise] which resolves to the return value of `callback`.

If the `callback` returns a [Promise], it will be awaited.

See `browser_context.expose_function()` for context-wide exposed function.

**NOTE** Functions installed via `page.expose_function()` survive navigations.

**Usage**

An example of adding a `sha256` function to the page:

```py
import hashlib
from playwright.sync_api import sync_playwright, Playwright

def sha256(text):
    m = hashlib.sha256()
    m.update(bytes(text, \"utf8\"))
    return m.hexdigest()

def run(playwright: Playwright):
    webkit = playwright.webkit
    browser = webkit.launch(headless=False)
    page = browser.new_page()
    page.expose_function(\"sha256\", sha256)
    page.set_content(\"\"\"
        <script>
          async function onClick() {
            document.querySelector('div').textContent = await window.sha256('PLAYWRIGHT');
          }
        </script>
        <button onclick=\"onClick()\">Click me</button>
        <div></div>
    \"\"\")
    page.click(\"button\")

with sync_playwright() as playwright:
    run(playwright)
```

Parameters
----------
name : str
    Name of the function on the window object
callback : Callable
    Callback function which will be called in Playwright's context.

◆ fill()

None playwright.sync_api._generated.Page.fill (   self,
str  selector,
str  value,
*typing.Optional[float]   timeout = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   force = None 
)
Page.fill

This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks,
focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string
to clear the input field.

If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an
error. However, if the element is inside the `<label>` element that has an associated
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
instead.

To send fine-grained keyboard events, use `locator.press_sequentially()`.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
value : str
    Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.

◆ focus()

None playwright.sync_api._generated.Page.focus (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.focus

This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the
method waits until a matching element appears in the DOM.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

◆ frame()

typing.Optional["Frame"] playwright.sync_api._generated.Page.frame (   self,
typing.Optional[str]   name = None,
*typing.Optional[ typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]] ]   url = None 
)
Page.frame

Returns frame matching the specified criteria. Either `name` or `url` must be specified.

**Usage**

```py
frame = page.frame(url=r\".*domain.*\")
```

Parameters
----------
name : Union[str, None]
    Frame name specified in the `iframe`'s `name` attribute. Optional.
url : Union[Callable[[str], bool], Pattern[str], str, None]
    A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.

Returns
-------
Union[Frame, None]

◆ frame_locator()

"FrameLocator" playwright.sync_api._generated.Page.frame_locator (   self,
str  selector 
)
Page.frame_locator

When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
in that iframe.

**Usage**

Following snippet locates element with text \"Submit\" in the iframe with id `my-frame`, like `<iframe
id=\"my-frame\">`:

```py
locator = page.frame_locator(\"#my-iframe\").get_by_text(\"Submit\")
locator.click()
```

Parameters
----------
selector : str
    A selector to use when resolving DOM element.

Returns
-------
FrameLocator

◆ frames()

typing.List["Frame"] playwright.sync_api._generated.Page.frames (   self)
Page.frames

An array of all frames attached to the page.

Returns
-------
List[Frame]

◆ get_attribute()

typing.Optional[str] playwright.sync_api._generated.Page.get_attribute (   self,
str  selector,
str  name,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.get_attribute

Returns element attribute value.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
name : str
    Attribute name to get the value for.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
Union[str, None]

◆ get_by_alt_text()

"Locator" playwright.sync_api._generated.Page.get_by_alt_text (   self,
typing.Union[str, typing.Pattern[str]]  text,
*typing.Optional[bool]   exact = None 
)
Page.get_by_alt_text

Allows locating elements by their alt text.

**Usage**

For example, this method will find the image by alt text \"Playwright logo\":

```html
<img alt='Playwright logo'>
```

```py
page.get_by_alt_text(\"Playwright logo\").click()
```

Parameters
----------
text : Union[Pattern[str], str]
    Text to locate the element for.
exact : Union[bool, None]
    Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
    regular expression. Note that exact match still trims whitespace.

Returns
-------
Locator

◆ get_by_label()

"Locator" playwright.sync_api._generated.Page.get_by_label (   self,
typing.Union[str, typing.Pattern[str]]  text,
*typing.Optional[bool]   exact = None 
)
Page.get_by_label

Allows locating input elements by the text of the associated `<label>` or `aria-labelledby` element, or by the
`aria-label` attribute.

**Usage**

For example, this method will find inputs by label \"Username\" and \"Password\" in the following DOM:

```html
<input aria-label=\"Username\">
<label for=\"password-input\">Password:</label>
<input id=\"password-input\">
```

```py
page.get_by_label(\"Username\").fill(\"john\")
page.get_by_label(\"Password\").fill(\"secret\")
```

Parameters
----------
text : Union[Pattern[str], str]
    Text to locate the element for.
exact : Union[bool, None]
    Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
    regular expression. Note that exact match still trims whitespace.

Returns
-------
Locator

◆ get_by_placeholder()

"Locator" playwright.sync_api._generated.Page.get_by_placeholder (   self,
typing.Union[str, typing.Pattern[str]]  text,
*typing.Optional[bool]   exact = None 
)
Page.get_by_placeholder

Allows locating input elements by the placeholder text.

**Usage**

For example, consider the following DOM structure.

```html
<input type=\"email\" placeholder=\"name@example.com\" />
```

You can fill the input after locating it by the placeholder text:

```py
page.get_by_placeholder(\"name@example.com\").fill(\"playwright@microsoft.com\")
```

Parameters
----------
text : Union[Pattern[str], str]
    Text to locate the element for.
exact : Union[bool, None]
    Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
    regular expression. Note that exact match still trims whitespace.

Returns
-------
Locator

◆ get_by_role()

"Locator" playwright.sync_api._generated.Page.get_by_role (   self,
Literal[ "alert", "alertdialog", "application", "article", "banner", "blockquote", "button", "caption", "cell", "checkbox", "code", "columnheader", "combobox", "complementary", "contentinfo", "definition", "deletion", "dialog", "directory", "document", "emphasis", "feed", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "insertion", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "strong", "subscript", "superscript", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "time", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem", ]  role,
*typing.Optional[bool]   checked = None,
typing.Optional[bool]   disabled = None,
typing.Optional[bool]   expanded = None,
typing.Optional[bool]   include_hidden = None,
typing.Optional[int]   level = None,
typing.Optional[typing.Union[typing.Pattern[str], str]]   name = None,
typing.Optional[bool]   pressed = None,
typing.Optional[bool]   selected = None,
typing.Optional[bool]   exact = None 
)
Page.get_by_role

Allows locating elements by their [ARIA role](https://www.w3.org/TR/wai-aria-1.2/#roles),
[ARIA attributes](https://www.w3.org/TR/wai-aria-1.2/#aria-attributes) and
[accessible name](https://w3c.github.io/accname/#dfn-accessible-name).

**Usage**

Consider the following DOM structure.

```html
<h3>Sign up</h3>
<label>
  <input type=\"checkbox\" /> Subscribe
</label>
<br/>
<button>Submit</button>
```

You can locate each element by it's implicit role:

```py
expect(page.get_by_role(\"heading\", name=\"Sign up\")).to_be_visible()

page.get_by_role(\"checkbox\", name=\"Subscribe\").check()

page.get_by_role(\"button\", name=re.compile(\"submit\", re.IGNORECASE)).click()
```

**Details**

Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback
about the ARIA guidelines.

Many html elements have an implicitly [defined role](https://w3c.github.io/html-aam/#html-element-role-mappings)
that is recognized by the role selector. You can find all the
[supported roles here](https://www.w3.org/TR/wai-aria-1.2/#role_definitions). ARIA guidelines **do not recommend**
duplicating implicit roles and attributes by setting `role` and/or `aria-*` attributes to default values.

Parameters
----------
role : Union["alert", "alertdialog", "application", "article", "banner", "blockquote", "button", "caption", "cell", "checkbox", "code", "columnheader", "combobox", "complementary", "contentinfo", "definition", "deletion", "dialog", "directory", "document", "emphasis", "feed", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "insertion", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "strong", "subscript", "superscript", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "time", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem"]
    Required aria role.
checked : Union[bool, None]
    An attribute that is usually set by `aria-checked` or native `<input type=checkbox>` controls.

    Learn more about [`aria-checked`](https://www.w3.org/TR/wai-aria-1.2/#aria-checked).
disabled : Union[bool, None]
    An attribute that is usually set by `aria-disabled` or `disabled`.

    **NOTE** Unlike most other attributes, `disabled` is inherited through the DOM hierarchy. Learn more about
    [`aria-disabled`](https://www.w3.org/TR/wai-aria-1.2/#aria-disabled).

expanded : Union[bool, None]
    An attribute that is usually set by `aria-expanded`.

    Learn more about [`aria-expanded`](https://www.w3.org/TR/wai-aria-1.2/#aria-expanded).
include_hidden : Union[bool, None]
    Option that controls whether hidden elements are matched. By default, only non-hidden elements, as
    [defined by ARIA](https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion), are matched by role selector.

    Learn more about [`aria-hidden`](https://www.w3.org/TR/wai-aria-1.2/#aria-hidden).
level : Union[int, None]
    A number attribute that is usually present for roles `heading`, `listitem`, `row`, `treeitem`, with default values
    for `<h1>-<h6>` elements.

    Learn more about [`aria-level`](https://www.w3.org/TR/wai-aria-1.2/#aria-level).
name : Union[Pattern[str], str, None]
    Option to match the [accessible name](https://w3c.github.io/accname/#dfn-accessible-name). By default, matching is
    case-insensitive and searches for a substring, use `exact` to control this behavior.

    Learn more about [accessible name](https://w3c.github.io/accname/#dfn-accessible-name).
pressed : Union[bool, None]
    An attribute that is usually set by `aria-pressed`.

    Learn more about [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.2/#aria-pressed).
selected : Union[bool, None]
    An attribute that is usually set by `aria-selected`.

    Learn more about [`aria-selected`](https://www.w3.org/TR/wai-aria-1.2/#aria-selected).
exact : Union[bool, None]
    Whether `name` is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when `name` is a
    regular expression. Note that exact match still trims whitespace.

Returns
-------
Locator

◆ get_by_test_id()

"Locator" playwright.sync_api._generated.Page.get_by_test_id (   self,
typing.Union[str, typing.Pattern[str]]   test_id 
)
Page.get_by_test_id

Locate element by the test id.

**Usage**

Consider the following DOM structure.

```html
<button data-testid=\"directions\">Itinéraire</button>
```

You can locate the element by it's test id:

```py
page.get_by_test_id(\"directions\").click()
```

**Details**

By default, the `data-testid` attribute is used as a test id. Use `selectors.set_test_id_attribute()` to
configure a different test id attribute if necessary.

Parameters
----------
test_id : Union[Pattern[str], str]
    Id to locate the element by.

Returns
-------
Locator

◆ get_by_text()

"Locator" playwright.sync_api._generated.Page.get_by_text (   self,
typing.Union[str, typing.Pattern[str]]  text,
*typing.Optional[bool]   exact = None 
)
Page.get_by_text

Allows locating elements that contain given text.

See also `locator.filter()` that allows to match by another criteria, like an accessible role, and then
filter by the text content.

**Usage**

Consider the following DOM structure:

```html
<div>Hello <span>world</span></div>
<div>Hello</div>
```

You can locate by text substring, exact string, or a regular expression:

```py
# Matches <span>
page.get_by_text(\"world\")

# Matches first <div>
page.get_by_text(\"Hello world\")

# Matches second <div>
page.get_by_text(\"Hello\", exact=True)

# Matches both <div>s
page.get_by_text(re.compile(\"Hello\"))

# Matches second <div>
page.get_by_text(re.compile(\"^hello$\", re.IGNORECASE))
```

**Details**

Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into
one, turns line breaks into spaces and ignores leading and trailing whitespace.

Input elements of the type `button` and `submit` are matched by their `value` instead of the text content. For
example, locating by text `\"Log in\"` matches `<input type=button value=\"Log in\">`.

Parameters
----------
text : Union[Pattern[str], str]
    Text to locate the element for.
exact : Union[bool, None]
    Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
    regular expression. Note that exact match still trims whitespace.

Returns
-------
Locator

◆ get_by_title()

"Locator" playwright.sync_api._generated.Page.get_by_title (   self,
typing.Union[str, typing.Pattern[str]]  text,
*typing.Optional[bool]   exact = None 
)
Page.get_by_title

Allows locating elements by their title attribute.

**Usage**

Consider the following DOM structure.

```html
<span title='Issues count'>25 issues</span>
```

You can check the issues count after locating it by the title text:

```py
expect(page.get_by_title(\"Issues count\")).to_have_text(\"25 issues\")
```

Parameters
----------
text : Union[Pattern[str], str]
    Text to locate the element for.
exact : Union[bool, None]
    Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
    regular expression. Note that exact match still trims whitespace.

Returns
-------
Locator

◆ go_back()

typing.Optional["Response"] playwright.sync_api._generated.Page.go_back (   self,
*typing.Optional[float]   timeout = None,
typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None 
)
Page.go_back

Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of
the last redirect. If cannot go back, returns `null`.

Navigate to the previous page in history.

Parameters
----------
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.

Returns
-------
Union[Response, None]

◆ go_forward()

typing.Optional["Response"] playwright.sync_api._generated.Page.go_forward (   self,
*typing.Optional[float]   timeout = None,
typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None 
)
Page.go_forward

Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of
the last redirect. If cannot go forward, returns `null`.

Navigate to the next page in history.

Parameters
----------
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.

Returns
-------
Union[Response, None]

◆ goto()

typing.Optional["Response"] playwright.sync_api._generated.Page.goto (   self,
str  url,
*typing.Optional[float]   timeout = None,
typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None,
typing.Optional[str]   referer = None 
)
Page.goto

Returns the main resource response. In case of multiple redirects, the navigation will resolve with the first
non-redirect response.

The method will throw an error if:
- there's an SSL error (e.g. in case of self-signed certificates).
- target URL is invalid.
- the `timeout` is exceeded during navigation.
- the remote server does not respond or is unreachable.
- the main resource failed to load.

The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404
\"Not Found\" and 500 \"Internal Server Error\".  The status code for such responses can be retrieved by calling
`response.status()`.

**NOTE** The method either throws an error or returns a main resource response. The only exceptions are navigation
to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.

**NOTE** Headless mode doesn't support navigation to a PDF document. See the
[upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).

Parameters
----------
url : str
    URL to navigate page to. The url should include scheme, e.g. `https://`. When a `baseURL` via the context options
    was provided and the passed URL is a path, it gets merged via the
    [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.
referer : Union[str, None]
    Referer header value. If provided it will take preference over the referer header value set by
    `page.set_extra_http_headers()`.

Returns
-------
Union[Response, None]

◆ hover()

None playwright.sync_api._generated.Page.hover (   self,
str  selector,
*typing.Optional[ typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]] ]   modifiers = None,
typing.Optional[Position]   position = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None 
)
Page.hover

This method hovers over an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.mouse` to hover over the center of the element, or the specified `position`.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
    Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
    current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
    "Control" on Windows and Linux and to "Meta" on macOS.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
    `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
    are pressed.

◆ inner_html()

str playwright.sync_api._generated.Page.inner_html (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.inner_html

Returns `element.innerHTML`.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
str

◆ inner_text()

str playwright.sync_api._generated.Page.inner_text (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.inner_text

Returns `element.innerText`.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
str

◆ input_value()

str playwright.sync_api._generated.Page.input_value (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.input_value

Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.

Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the
control.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
str

◆ is_checked()

bool playwright.sync_api._generated.Page.is_checked (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.is_checked

Returns whether the element is checked. Throws if the element is not a checkbox or radio input.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
bool

◆ is_closed()

bool playwright.sync_api._generated.Page.is_closed (   self)
Page.is_closed

Indicates that the page has been closed.

Returns
-------
bool

◆ is_disabled()

bool playwright.sync_api._generated.Page.is_disabled (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.is_disabled

Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/python/docs/actionability#enabled).

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
bool

◆ is_editable()

bool playwright.sync_api._generated.Page.is_editable (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.is_editable

Returns whether the element is [editable](https://playwright.dev/python/docs/actionability#editable).

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
bool

◆ is_enabled()

bool playwright.sync_api._generated.Page.is_enabled (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.is_enabled

Returns whether the element is [enabled](https://playwright.dev/python/docs/actionability#enabled).

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
bool

◆ is_hidden()

bool playwright.sync_api._generated.Page.is_hidden (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.is_hidden

Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/python/docs/actionability#visible).  `selector` that
does not match any elements is considered hidden.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Deprecated: This option is ignored. `page.is_hidden()` does not wait for the↵element to become hidden and returns immediately.

Returns
-------
bool

◆ is_visible()

bool playwright.sync_api._generated.Page.is_visible (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.is_visible

Returns whether the element is [visible](https://playwright.dev/python/docs/actionability#visible). `selector` that does not match any elements
is considered not visible.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Deprecated: This option is ignored. `page.is_visible()` does not wait↵for the element to become visible and returns immediately.

Returns
-------
bool

◆ keyboard()

"Keyboard" playwright.sync_api._generated.Page.keyboard (   self)
Page.keyboard

Returns
-------
Keyboard

◆ locator()

"Locator" playwright.sync_api._generated.Page.locator (   self,
str  selector,
*typing.Optional[typing.Union[typing.Pattern[str], str]]   has_text = None,
typing.Optional[typing.Union[typing.Pattern[str], str]]   has_not_text = None,
typing.Optional["Locator"]   has = None,
typing.Optional["Locator"]   has_not = None 
)
Page.locator

The method returns an element locator that can be used to perform actions on this page / frame. Locator is resolved
to the element immediately before performing an action, so a series of actions on the same locator can in fact be
performed on different DOM elements. That would happen if the DOM structure between those actions has changed.

[Learn more about locators](https://playwright.dev/python/docs/locators).

Parameters
----------
selector : str
    A selector to use when resolving DOM element.
has_text : Union[Pattern[str], str, None]
    Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When
    passed a [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
    `<article><div>Playwright</div></article>`.
has_not_text : Union[Pattern[str], str, None]
    Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element.
    When passed a [string], matching is case-insensitive and searches for a substring.
has : Union[Locator, None]
    Narrows down the results of the method to those which contain elements matching this relative locator. For example,
    `article` that has `text=Playwright` matches `<article><div>Playwright</div></article>`.

    Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not
    the document root. For example, you can find `content` that has `div` in
    `<article><content><div>Playwright</div></content></article>`. However, looking for `content` that has `article
    div` will fail, because the inner locator must be relative and should not use any elements outside the `content`.

    Note that outer and inner locators must belong to the same frame. Inner locator must not contain `FrameLocator`s.
has_not : Union[Locator, None]
    Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
    outer one. For example, `article` that does not have `div` matches `<article><span>Playwright</span></article>`.

    Note that outer and inner locators must belong to the same frame. Inner locator must not contain `FrameLocator`s.

Returns
-------
Locator

◆ main_frame()

"Frame" playwright.sync_api._generated.Page.main_frame (   self)
Page.main_frame

The page's main frame. Page is guaranteed to have a main frame which persists during navigations.

Returns
-------
Frame

◆ mouse()

"Mouse" playwright.sync_api._generated.Page.mouse (   self)
Page.mouse

Returns
-------
Mouse

◆ on() [1/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["close"]  event,
typing.Callable[["Page"], "None"]  f 
)
Emitted when the page closes.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [2/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["console"]  event,
typing.Callable[["ConsoleMessage"], "None"]   f 
)
Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`.

The arguments passed into `console.log` are available on the `ConsoleMessage` event handler argument.

**Usage**

```py
def print_args(msg):
    for arg in msg.args:
        print(arg.json_value())

page.on(\"console\", print_args)
page.evaluate(\"console.log('hello', 5, { foo: 'bar' })\")
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [3/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["crash"]  event,
typing.Callable[["Page"], "None"]  f 
)
Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page
crashes, ongoing and subsequent operations will throw.

The most common way to deal with crashes is to catch an exception:

```py
try:
    # crash might happen during a click.
    page.click(\"button\")
    # or while waiting for an event.
    page.wait_for_event(\"popup\")
except Error as e:
    pass
    # when the page crashes, exception message contains \"crash\".
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [4/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["dialog"]  event,
typing.Callable[["Dialog"], "None"]   f 
)
Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Listener **must**
either `dialog.accept()` or `dialog.dismiss()` the dialog - otherwise the page will
[freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog,
and actions like click will never finish.

**Usage**

```python
page.on(\"dialog\", lambda dialog: dialog.accept())
```

**NOTE** When no `page.on('dialog')` or `browser_context.on('dialog')` listeners are present, all dialogs are
automatically dismissed.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [5/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["domcontentloaded"]  event,
typing.Callable[["Page"], "None"]   f 
)
Emitted when the JavaScript
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [6/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["download"]  event,
typing.Callable[["Download"], "None"]   f 
)
Emitted when attachment download started. User can access basic file operations on downloaded content via the
passed `Download` instance.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [7/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["filechooser"]  event,
typing.Callable[["FileChooser"], "None"]   f 
)
Emitted when a file chooser is supposed to appear, such as after clicking the  `<input type=file>`. Playwright can
respond to it via setting the input files using `file_chooser.set_files()` that can be uploaded after that.

```py
page.on(\"filechooser\", lambda file_chooser: file_chooser.set_files(\"/tmp/myfile.pdf\"))
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [8/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["frameattached"]  event,
typing.Callable[["Frame"], "None"]   f 
)
Emitted when a frame is attached.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [9/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["framedetached"]  event,
typing.Callable[["Frame"], "None"]   f 
)
Emitted when a frame is detached.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [10/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["framenavigated"]  event,
typing.Callable[["Frame"], "None"]   f 
)
Emitted when a frame is navigated to a new url.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [11/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["load"]  event,
typing.Callable[["Page"], "None"]  f 
)
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [12/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["pageerror"]  event,
typing.Callable[["Error"], "None"]   f 
)
Emitted when an uncaught exception happens within the page.

```py
# Log all uncaught errors to the terminal
page.on(\"pageerror\", lambda exc: print(f\"uncaught exception: {exc}\"))

# Navigate to a page with an exception.
page.goto(\"data:text/html,<script>throw new Error('test')</script>\")
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [13/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["popup"]  event,
typing.Callable[["Page"], "None"]  f 
)
Emitted when the page opens a new tab or window. This event is emitted in addition to the
`browser_context.on('page')`, but only for popups relevant to this page.

The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a
popup with `window.open('http://example.com')`, this event will fire when the network request to
\"http://example.com\" is done and its response has started loading in the popup. If you would like to route/listen
to this network request, use `browser_context.route()` and `browser_context.on('request')` respectively
instead of similar methods on the `Page`.

```py
with page.expect_event(\"popup\") as page_info:
    page.get_by_text(\"open the popup\").click()
popup = page_info.value
print(popup.evaluate(\"location.href\"))
```

**NOTE** Use `page.wait_for_load_state()` to wait until the page gets to a particular state (you should not
need it in most cases).

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [14/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["request"]  event,
typing.Callable[["Request"], "None"]   f 
)
Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests,
see `page.route()` or `browser_context.route()`.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [15/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["requestfailed"]  event,
typing.Callable[["Request"], "None"]   f 
)
Emitted when a request fails, for example by timing out.

```python
page.on(\"requestfailed\", lambda request: print(request.url + \" \" + request.failure.error_text))
```

**NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request
will complete with `page.on('request_finished')` event and not with `page.on('request_failed')`. A request will
only be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error
net::ERR_FAILED.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [16/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["requestfinished"]  event,
typing.Callable[["Request"], "None"]   f 
)
Emitted when a request finishes successfully after downloading the response body. For a successful response, the
sequence of events is `request`, `response` and `requestfinished`.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [17/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["response"]  event,
typing.Callable[["Response"], "None"]   f 
)
Emitted when [response] status and headers are received for a request. For a successful response, the sequence of
events is `request`, `response` and `requestfinished`.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [18/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["websocket"]  event,
typing.Callable[["WebSocket"], "None"]   f 
)
Emitted when `WebSocket` request is sent.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [19/20]

None playwright.sync_api._generated.Page.on (   self,
Literal["worker"]  event,
typing.Callable[["Worker"], "None"]   f 
)
Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned
by the page.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ on() [20/20]

None playwright.sync_api._generated.Page.on (   self,
str  event,
typing.Callable[..., None]  f 
)
Registers the function ``f`` to the event name ``event``.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [1/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["close"]  event,
typing.Callable[["Page"], "None"]   f 
)
Emitted when the page closes.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [2/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["console"]  event,
typing.Callable[["ConsoleMessage"], "None"]   f 
)
Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`.

The arguments passed into `console.log` are available on the `ConsoleMessage` event handler argument.

**Usage**

```py
def print_args(msg):
    for arg in msg.args:
        print(arg.json_value())

page.on(\"console\", print_args)
page.evaluate(\"console.log('hello', 5, { foo: 'bar' })\")
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [3/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["crash"]  event,
typing.Callable[["Page"], "None"]   f 
)
Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page
crashes, ongoing and subsequent operations will throw.

The most common way to deal with crashes is to catch an exception:

```py
try:
    # crash might happen during a click.
    page.click(\"button\")
    # or while waiting for an event.
    page.wait_for_event(\"popup\")
except Error as e:
    pass
    # when the page crashes, exception message contains \"crash\".
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [4/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["dialog"]  event,
typing.Callable[["Dialog"], "None"]   f 
)
Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Listener **must**
either `dialog.accept()` or `dialog.dismiss()` the dialog - otherwise the page will
[freeze](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#never_blocking) waiting for the dialog,
and actions like click will never finish.

**Usage**

```python
page.on(\"dialog\", lambda dialog: dialog.accept())
```

**NOTE** When no `page.on('dialog')` or `browser_context.on('dialog')` listeners are present, all dialogs are
automatically dismissed.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [5/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["domcontentloaded"]  event,
typing.Callable[["Page"], "None"]   f 
)
Emitted when the JavaScript
[`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [6/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["download"]  event,
typing.Callable[["Download"], "None"]   f 
)
Emitted when attachment download started. User can access basic file operations on downloaded content via the
passed `Download` instance.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [7/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["filechooser"]  event,
typing.Callable[["FileChooser"], "None"]   f 
)
Emitted when a file chooser is supposed to appear, such as after clicking the  `<input type=file>`. Playwright can
respond to it via setting the input files using `file_chooser.set_files()` that can be uploaded after that.

```py
page.on(\"filechooser\", lambda file_chooser: file_chooser.set_files(\"/tmp/myfile.pdf\"))
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [8/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["frameattached"]  event,
typing.Callable[["Frame"], "None"]   f 
)
Emitted when a frame is attached.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [9/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["framedetached"]  event,
typing.Callable[["Frame"], "None"]   f 
)
Emitted when a frame is detached.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [10/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["framenavigated"]  event,
typing.Callable[["Frame"], "None"]   f 
)
Emitted when a frame is navigated to a new url.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [11/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["load"]  event,
typing.Callable[["Page"], "None"]   f 
)
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [12/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["pageerror"]  event,
typing.Callable[["Error"], "None"]   f 
)
Emitted when an uncaught exception happens within the page.

```py
# Log all uncaught errors to the terminal
page.on(\"pageerror\", lambda exc: print(f\"uncaught exception: {exc}\"))

# Navigate to a page with an exception.
page.goto(\"data:text/html,<script>throw new Error('test')</script>\")
```

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [13/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["popup"]  event,
typing.Callable[["Page"], "None"]   f 
)
Emitted when the page opens a new tab or window. This event is emitted in addition to the
`browser_context.on('page')`, but only for popups relevant to this page.

The earliest moment that page is available is when it has navigated to the initial url. For example, when opening a
popup with `window.open('http://example.com')`, this event will fire when the network request to
\"http://example.com\" is done and its response has started loading in the popup. If you would like to route/listen
to this network request, use `browser_context.route()` and `browser_context.on('request')` respectively
instead of similar methods on the `Page`.

```py
with page.expect_event(\"popup\") as page_info:
    page.get_by_text(\"open the popup\").click()
popup = page_info.value
print(popup.evaluate(\"location.href\"))
```

**NOTE** Use `page.wait_for_load_state()` to wait until the page gets to a particular state (you should not
need it in most cases).

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [14/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["request"]  event,
typing.Callable[["Request"], "None"]   f 
)
Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests,
see `page.route()` or `browser_context.route()`.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [15/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["requestfailed"]  event,
typing.Callable[["Request"], "None"]   f 
)
Emitted when a request fails, for example by timing out.

```python
page.on(\"requestfailed\", lambda request: print(request.url + \" \" + request.failure.error_text))
```

**NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request
will complete with `page.on('request_finished')` event and not with `page.on('request_failed')`. A request will
only be considered failed when the client cannot get an HTTP response from the server, e.g. due to network error
net::ERR_FAILED.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [16/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["requestfinished"]  event,
typing.Callable[["Request"], "None"]   f 
)
Emitted when a request finishes successfully after downloading the response body. For a successful response, the
sequence of events is `request`, `response` and `requestfinished`.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [17/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["response"]  event,
typing.Callable[["Response"], "None"]   f 
)
Emitted when [response] status and headers are received for a request. For a successful response, the sequence of
events is `request`, `response` and `requestfinished`.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [18/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["websocket"]  event,
typing.Callable[["WebSocket"], "None"]   f 
)
Emitted when `WebSocket` request is sent.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [19/20]

None playwright.sync_api._generated.Page.once (   self,
Literal["worker"]  event,
typing.Callable[["Worker"], "None"]   f 
)
Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned
by the page.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ once() [20/20]

None playwright.sync_api._generated.Page.once (   self,
str  event,
typing.Callable[..., None]  f 
)
The same as ``self.on``, except that the listener is automatically
removed after being called.

Reimplemented from playwright._impl._sync_base.SyncBase.

◆ opener()

typing.Optional["Page"] playwright.sync_api._generated.Page.opener (   self)
Page.opener

Returns the opener for popup pages and `null` for others. If the opener has been closed already the returns `null`.

Returns
-------
Union[Page, None]

◆ page_errors()

typing.List["Error"] playwright.sync_api._generated.Page.page_errors (   self)
Page.page_errors

Returns up to (currently) 200 last page errors from this page. See `page.on('page_error')` for more details.

Returns
-------
List[Error]

◆ pause()

None playwright.sync_api._generated.Page.pause (   self)
Page.pause

Pauses script execution. Playwright will stop executing the script and wait for the user to either press the
'Resume' button in the page overlay or to call `playwright.resume()` in the DevTools console.

User can inspect selectors or perform manual steps while paused. Resume will continue running the original script
from the place it was paused.

**NOTE** This method requires Playwright to be started in a headed mode, with a falsy `headless` option.

◆ pdf()

bytes playwright.sync_api._generated.Page.pdf (   self,
*typing.Optional[float]   scale = None,
typing.Optional[bool]   display_header_footer = None,
typing.Optional[str]   header_template = None,
typing.Optional[str]   footer_template = None,
typing.Optional[bool]   print_background = None,
typing.Optional[bool]   landscape = None,
typing.Optional[str]   page_ranges = None,
typing.Optional[str]   format = None,
typing.Optional[typing.Union[str, float]]   width = None,
typing.Optional[typing.Union[str, float]]   height = None,
typing.Optional[bool]   prefer_css_page_size = None,
typing.Optional[PdfMargins]   margin = None,
typing.Optional[typing.Union[pathlib.Path, str]]   path = None,
typing.Optional[bool]   outline = None,
typing.Optional[bool]   tagged = None 
)
Page.pdf

Returns the PDF buffer.

`page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
`page.emulate_media()` before calling `page.pdf()`:

**NOTE** By default, `page.pdf()` generates a pdf with modified colors for printing. Use the
[`-webkit-print-color-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust)
property to force rendering of exact colors.

**Usage**

```py
# generates a pdf with \"screen\" media type.
page.emulate_media(media=\"screen\")
page.pdf(path=\"page.pdf\")
```

The `width`, `height`, and `margin` options accept values labeled with units. Unlabeled values are treated as
pixels.

A few examples:
- `page.pdf({width: 100})` - prints with width set to 100 pixels
- `page.pdf({width: '100px'})` - prints with width set to 100 pixels
- `page.pdf({width: '10cm'})` - prints with width set to 10 centimeters.

All possible units are:
- `px` - pixel
- `in` - inch
- `cm` - centimeter
- `mm` - millimeter

The `format` options are:
- `Letter`: 8.5in x 11in
- `Legal`: 8.5in x 14in
- `Tabloid`: 11in x 17in
- `Ledger`: 17in x 11in
- `A0`: 33.1in x 46.8in
- `A1`: 23.4in x 33.1in
- `A2`: 16.54in x 23.4in
- `A3`: 11.7in x 16.54in
- `A4`: 8.27in x 11.7in
- `A5`: 5.83in x 8.27in
- `A6`: 4.13in x 5.83in

**NOTE** `headerTemplate` and `footerTemplate` markup have the following limitations: > 1. Script tags inside
templates are not evaluated. > 2. Page styles are not visible inside templates.

Parameters
----------
scale : Union[float, None]
    Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.
display_header_footer : Union[bool, None]
    Display header and footer. Defaults to `false`.
header_template : Union[str, None]
    HTML template for the print header. Should be valid HTML markup with following classes used to inject printing
    values into them:
    - `'date'` formatted print date
    - `'title'` document title
    - `'url'` document location
    - `'pageNumber'` current page number
    - `'totalPages'` total pages in the document
footer_template : Union[str, None]
    HTML template for the print footer. Should use the same format as the `headerTemplate`.
print_background : Union[bool, None]
    Print background graphics. Defaults to `false`.
landscape : Union[bool, None]
    Paper orientation. Defaults to `false`.
page_ranges : Union[str, None]
    Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
format : Union[str, None]
    Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'.
width : Union[float, str, None]
    Paper width, accepts values labeled with units.
height : Union[float, str, None]
    Paper height, accepts values labeled with units.
prefer_css_page_size : Union[bool, None]
    Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format`
    options. Defaults to `false`, which will scale the content to fit the paper size.
margin : Union[{top: Union[float, str, None], right: Union[float, str, None], bottom: Union[float, str, None], left: Union[float, str, None]}, None]
    Paper margins, defaults to none.
path : Union[pathlib.Path, str, None]
    The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to the current working
    directory. If no path is provided, the PDF won't be saved to the disk.
outline : Union[bool, None]
    Whether or not to embed the document outline into the PDF. Defaults to `false`.
tagged : Union[bool, None]
    Whether or not to generate tagged (accessible) PDF. Defaults to `false`.

Returns
-------
bytes

◆ press()

None playwright.sync_api._generated.Page.press (   self,
str  selector,
str  key,
*typing.Optional[float]   delay = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None 
)
Page.press

Focuses the element, and then uses `keyboard.down()` and `keyboard.up()`.

`key` can specify the intended
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character
to generate the text for. A superset of the `key` values can be found
[here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:

`F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`,
`Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`,
etc.

Following modification shortcuts are also supported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`,
`ControlOrMeta`. `ControlOrMeta` resolves to `Control` on Windows and Linux and to `Meta` on macOS.

Holding down `Shift` will type the text that corresponds to the `key` in the upper case.

If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective
texts.

Shortcuts such as `key: \"Control+o\"`, `key: \"Control++` or `key: \"Control+Shift+T\"` are supported as well. When
specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.

**Usage**

```py
page = browser.new_page()
page.goto(\"https://keycode.info\")
page.press(\"body\", \"A\")
page.screenshot(path=\"a.png\")
page.press(\"body\", \"ArrowLeft\")
page.screenshot(path=\"arrow_left.png\")
page.press(\"body\", \"Shift+O\")
page.screenshot(path=\"o.png\")
browser.close()
```

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
key : str
    Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
delay : Union[float, None]
    Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
no_wait_after : Union[bool, None]
    Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
    can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
    navigating to inaccessible pages. Defaults to `false`.
    Deprecated: This option will default to `true` in the future.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

◆ query_selector()

typing.Optional["ElementHandle"] playwright.sync_api._generated.Page.query_selector (   self,
str  selector,
*typing.Optional[bool]   strict = None 
)
Page.query_selector

The method finds an element matching the specified selector within the page. If no elements match the selector, the
return value resolves to `null`. To wait for an element on the page, use `locator.wait_for()`.

Parameters
----------
selector : str
    A selector to query for.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

Returns
-------
Union[ElementHandle, None]

◆ query_selector_all()

typing.List["ElementHandle"] playwright.sync_api._generated.Page.query_selector_all (   self,
str  selector 
)
Page.query_selector_all

The method finds all elements matching the specified selector within the page. If no elements match the selector,
the return value resolves to `[]`.

Parameters
----------
selector : str
    A selector to query for.

Returns
-------
List[ElementHandle]

◆ reload()

typing.Optional["Response"] playwright.sync_api._generated.Page.reload (   self,
*typing.Optional[float]   timeout = None,
typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None 
)
Page.reload

This method reloads the current page, in the same way as if the user had triggered a browser refresh. Returns the
main resource response. In case of multiple redirects, the navigation will resolve with the response of the last
redirect.

Parameters
----------
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.

Returns
-------
Union[Response, None]

◆ remove_locator_handler()

None playwright.sync_api._generated.Page.remove_locator_handler (   self,
"Locator"  locator 
)
Page.remove_locator_handler

Removes all locator handlers added by `page.add_locator_handler()` for a specific locator.

Parameters
----------
locator : Locator
    Locator passed to `page.add_locator_handler()`.

◆ request()

"APIRequestContext" playwright.sync_api._generated.Page.request (   self)
Page.request

API testing helper associated with this page. This method returns the same instance as
`browser_context.request` on the page's context. See `browser_context.request` for more
details.

Returns
-------
APIRequestContext

◆ request_gc()

None playwright.sync_api._generated.Page.request_gc (   self)
Page.request_gc

Request the page to perform garbage collection. Note that there is no guarantee that all unreachable objects will
be collected.

This is useful to help detect memory leaks. For example, if your page has a large object `'suspect'` that might be
leaked, you can check that it does not leak by using a
[`WeakRef`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef).

```py
# 1. In your page, save a WeakRef for the \"suspect\".
page.evaluate(\"globalThis.suspectWeakRef = new WeakRef(suspect)\")
# 2. Request garbage collection.
page.request_gc()
# 3. Check that weak ref does not deref to the original object.
assert page.evaluate(\"!globalThis.suspectWeakRef.deref()\")
```

◆ requests()

typing.List["Request"] playwright.sync_api._generated.Page.requests (   self)
Page.requests

Returns up to (currently) 100 last network request from this page. See `page.on('request')` for more details.

Returned requests should be accessed immediately, otherwise they might be collected to prevent unbounded memory
growth as new requests come in. Once collected, retrieving most information about the request is impossible.

Note that requests reported through the `page.on('request')` request are not collected, so there is a trade off
between efficient memory usage with `page.requests()` and the amount of available information reported
through `page.on('request')`.

Returns
-------
List[Request]

◆ route()

None playwright.sync_api._generated.Page.route (   self,
typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]]  url,
typing.Union[ typing.Callable[["Route"], typing.Any], typing.Callable[["Route", "Request"], typing.Any], ]  handler,
*typing.Optional[int]   times = None 
)
Page.route

Routing provides the capability to modify network requests that are made by a page.

Once routing is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or
aborted.

**NOTE** The handler will only be called for the first url if the response is a redirect.

**NOTE** `page.route()` will not intercept requests intercepted by Service Worker. See
[this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when
using request interception by setting `serviceWorkers` to `'block'`.

**NOTE** `page.route()` will not intercept the first request of a popup page. Use
`browser_context.route()` instead.

**Usage**

An example of a naive handler that aborts all image requests:

```py
page = browser.new_page()
page.route(\"**/*.{png,jpg,jpeg}\", lambda route: route.abort())
page.goto(\"https://example.com\")
browser.close()
```

or the same snippet using a regex pattern instead:

```py
page = browser.new_page()
page.route(re.compile(r\"(\\.png$)|(\\.jpg$)\"), lambda route: route.abort())
page.goto(\"https://example.com\")
browser.close()
```

It is possible to examine the request to decide the route action. For example, mocking all requests that contain
some post data, and leaving all other requests as is:

```py
def handle_route(route: Route):
  if (\"my-string\" in route.request.post_data):
    route.fulfill(body=\"mocked-data\")
  else:
    route.continue_()
page.route(\"/api/**\", handle_route)
```

Page routes take precedence over browser context routes (set up with `browser_context.route()`) when request
matches both handlers.

To remove a route with its handler you can use `page.unroute()`.

**NOTE** Enabling routing disables http cache.

Parameters
----------
url : Union[Callable[[str], bool], Pattern[str], str]
    A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If `baseURL` is set in
    the context options and the provided URL is a string that does not start with `*`, it is resolved using the
    [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
handler : Union[Callable[[Route, Request], Any], Callable[[Route], Any]]
    handler function to route the request.
times : Union[int, None]
    How often a route should be used. By default it will be used every time.

◆ route_from_har()

None playwright.sync_api._generated.Page.route_from_har (   self,
typing.Union[pathlib.Path, str]  har,
*typing.Optional[typing.Union[typing.Pattern[str], str]]   url = None,
typing.Optional[Literal["abort", "fallback"]]   not_found = None,
typing.Optional[bool]   update = None,
typing.Optional[Literal["attach", "embed"]]   update_content = None,
typing.Optional[Literal["full", "minimal"]]   update_mode = None 
)
Page.route_from_har

If specified the network requests that are made in the page will be served from the HAR file. Read more about
[Replaying from HAR](https://playwright.dev/python/docs/mock#replaying-from-har).

Playwright will not serve requests intercepted by Service Worker from the HAR file. See
[this](https://github.com/microsoft/playwright/issues/1090) issue. We recommend disabling Service Workers when
using request interception by setting `serviceWorkers` to `'block'`.

Parameters
----------
har : Union[pathlib.Path, str]
    Path to a [HAR](http://www.softwareishard.com/blog/har-12-spec) file with prerecorded network data. If `path` is a
    relative path, then it is resolved relative to the current working directory.
url : Union[Pattern[str], str, None]
    A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the
    pattern will be served from the HAR file. If not specified, all requests are served from the HAR file.
not_found : Union["abort", "fallback", None]
    - If set to 'abort' any request not found in the HAR file will be aborted.
    - If set to 'fallback' missing requests will be sent to the network.

    Defaults to abort.
update : Union[bool, None]
    If specified, updates the given HAR with the actual network information instead of serving from file. The file is
    written to disk when `browser_context.close()` is called.
update_content : Union["attach", "embed", None]
    Optional setting to control resource content management. If `attach` is specified, resources are persisted as
    separate files or entries in the ZIP archive. If `embed` is specified, content is stored inline the HAR file.
update_mode : Union["full", "minimal", None]
    When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page,
    cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to
    `minimal`.

◆ route_web_socket()

None playwright.sync_api._generated.Page.route_web_socket (   self,
typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]]  url,
typing.Callable[["WebSocketRoute"], typing.Any]  handler 
)
Page.route_web_socket

This method allows to modify websocket connections that are made by the page.

Note that only `WebSocket`s created after this method was called will be routed. It is recommended to call this
method before navigating the page.

**Usage**

Below is an example of a simple mock that responds to a single message. See `WebSocketRoute` for more details and
examples.

```py
def message_handler(ws: WebSocketRoute, message: Union[str, bytes]):
  if message == \"request\":
    ws.send(\"response\")

def handler(ws: WebSocketRoute):
  ws.on_message(lambda message: message_handler(ws, message))

page.route_web_socket(\"/ws\", handler)
```

Parameters
----------
url : Union[Callable[[str], bool], Pattern[str], str]
    Only WebSockets with the url matching this pattern will be routed. A string pattern can be relative to the
    `baseURL` context option.
handler : Callable[[WebSocketRoute], Any]
    Handler function to route the WebSocket.

◆ screenshot()

bytes playwright.sync_api._generated.Page.screenshot (   self,
*typing.Optional[float]   timeout = None,
typing.Optional[Literal["jpeg", "png"]]   type = None,
typing.Optional[typing.Union[pathlib.Path, str]]   path = None,
typing.Optional[int]   quality = None,
typing.Optional[bool]   omit_background = None,
typing.Optional[bool]   full_page = None,
typing.Optional[FloatRect]   clip = None,
typing.Optional[Literal["allow", "disabled"]]   animations = None,
typing.Optional[Literal["hide", "initial"]]   caret = None,
typing.Optional[Literal["css", "device"]]   scale = None,
typing.Optional[typing.Sequence["Locator"]]   mask = None,
typing.Optional[str]   mask_color = None,
typing.Optional[str]   style = None 
)
Page.screenshot

Returns the buffer with the captured screenshot.

Parameters
----------
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
type : Union["jpeg", "png", None]
    Specify screenshot type, defaults to `png`.
path : Union[pathlib.Path, str, None]
    The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a
    relative path, then it is resolved relative to the current working directory. If no path is provided, the image
    won't be saved to the disk.
quality : Union[int, None]
    The quality of the image, between 0-100. Not applicable to `png` images.
omit_background : Union[bool, None]
    Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.
    Defaults to `false`.
full_page : Union[bool, None]
    When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to
    `false`.
clip : Union[{x: float, y: float, width: float, height: float}, None]
    An object which specifies clipping of the resulting image.
animations : Union["allow", "disabled", None]
    When set to `"disabled"`, stops CSS animations, CSS transitions and Web Animations. Animations get different
    treatment depending on their duration:
    - finite animations are fast-forwarded to completion, so they'll fire `transitionend` event.
    - infinite animations are canceled to initial state, and then played over after the screenshot.

    Defaults to `"allow"` that leaves animations untouched.
caret : Union["hide", "initial", None]
    When set to `"hide"`, screenshot will hide text caret. When set to `"initial"`, text caret behavior will not be
    changed.  Defaults to `"hide"`.
scale : Union["css", "device", None]
    When set to `"css"`, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this
    will keep screenshots small. Using `"device"` option will produce a single pixel per each device pixel, so
    screenshots of high-dpi devices will be twice as large or even larger.

    Defaults to `"device"`.
mask : Union[Sequence[Locator], None]
    Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
    box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box. The mask is also applied to
    invisible elements, see [Matching only visible elements](../locators.md#matching-only-visible-elements) to disable
    that.
mask_color : Union[str, None]
    Specify the color of the overlay box for masked elements, in
    [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
style : Union[str, None]
    Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make
    elements invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces
    the Shadow DOM and applies to the inner frames.

Returns
-------
bytes

◆ select_option()

typing.List[str] playwright.sync_api._generated.Page.select_option (   self,
str  selector,
typing.Optional[typing.Union[str, typing.Sequence[str]]]   value = None,
*typing.Optional[typing.Union[int, typing.Sequence[int]]]   index = None,
typing.Optional[typing.Union[str, typing.Sequence[str]]]   label = None,
typing.Optional[ typing.Union["ElementHandle", typing.Sequence["ElementHandle"]] ]   element = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   strict = None 
)
Page.select_option

This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks, waits
until all specified options are present in the `<select>` element and selects these options.

If the target element is not a `<select>` element, this method throws an error. However, if the element is inside
the `<label>` element that has an associated
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used
instead.

Returns the array of option values that have been successfully selected.

Triggers a `change` and `input` event once all the provided options have been selected.

**Usage**

```py
# Single selection matching the value or label
page.select_option(\"select#colors\", \"blue\")
# single selection matching both the label
page.select_option(\"select#colors\", label=\"blue\")
# multiple selection
page.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"])
```

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
value : Union[Sequence[str], str, None]
    Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected,
    otherwise only the first option matching one of the passed options is selected. Optional.
index : Union[Sequence[int], int, None]
    Options to select by index. Optional.
label : Union[Sequence[str], str, None]
    Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected,
    otherwise only the first option matching one of the passed options is selected. Optional.
element : Union[ElementHandle, Sequence[ElementHandle], None]
    Option elements to select. Optional.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

Returns
-------
List[str]

◆ set_checked()

None playwright.sync_api._generated.Page.set_checked (   self,
str  selector,
bool  checked,
*typing.Optional[Position]   position = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None 
)
Page.set_checked

This method checks or unchecks an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
1. If the element already has the right checked state, this method returns immediately.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.mouse` to click in the center of the element.
1. Ensure that the element is now checked or unchecked. If not, this method throws.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
checked : bool
    Whether to check or uncheck the checkbox.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it.

◆ set_content()

None playwright.sync_api._generated.Page.set_content (   self,
str  html,
*typing.Optional[float]   timeout = None,
typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None 
)
Page.set_content

This method internally calls [document.write()](https://developer.mozilla.org/en-US/docs/Web/API/Document/write),
inheriting all its specific characteristics and behaviors.

Parameters
----------
html : str
    HTML markup to assign to the page.
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.

◆ set_default_navigation_timeout()

None playwright.sync_api._generated.Page.set_default_navigation_timeout (   self,
float  timeout 
)
Page.set_default_navigation_timeout

This setting will change the default maximum navigation time for the following methods and related shortcuts:
- `page.go_back()`
- `page.go_forward()`
- `page.goto()`
- `page.reload()`
- `page.set_content()`
- `page.expect_navigation()`
- `page.wait_for_url()`

**NOTE** `page.set_default_navigation_timeout()` takes priority over `page.set_default_timeout()`,
`browser_context.set_default_timeout()` and `browser_context.set_default_navigation_timeout()`.

Parameters
----------
timeout : float
    Maximum navigation time in milliseconds

◆ set_default_timeout()

None playwright.sync_api._generated.Page.set_default_timeout (   self,
float  timeout 
)
Page.set_default_timeout

This setting will change the default maximum time for all the methods accepting `timeout` option.

**NOTE** `page.set_default_navigation_timeout()` takes priority over `page.set_default_timeout()`.

Parameters
----------
timeout : float
    Maximum time in milliseconds. Pass `0` to disable timeout.

◆ set_extra_http_headers()

None playwright.sync_api._generated.Page.set_extra_http_headers (   self,
typing.Dict[str, str]  headers 
)
Page.set_extra_http_headers

The extra HTTP headers will be sent with every request the page initiates.

**NOTE** `page.set_extra_http_headers()` does not guarantee the order of headers in the outgoing requests.

Parameters
----------
headers : Dict[str, str]
    An object containing additional HTTP headers to be sent with every request. All header values must be strings.

◆ set_input_files()

None playwright.sync_api._generated.Page.set_input_files (   self,
str  selector,
typing.Union[ str, pathlib.Path, FilePayload, typing.Sequence[typing.Union[str, pathlib.Path]], typing.Sequence[FilePayload], ]  files,
*typing.Optional[float]   timeout = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   no_wait_after = None 
)
Page.set_input_files

Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then
they are resolved relative to the current working directory. For empty array, clears the selected files. For inputs
with a `[webkitdirectory]` attribute, only a single directory path is supported.

This method expects `selector` to point to an
[input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside
the `<label>` element that has an associated
[control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), targets the control instead.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
files : Union[Sequence[Union[pathlib.Path, str]], Sequence[{name: str, mimeType: str, buffer: bytes}], pathlib.Path, str, {name: str, mimeType: str, buffer: bytes}]
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.

◆ set_viewport_size()

None playwright.sync_api._generated.Page.set_viewport_size (   self,
ViewportSize  viewport_size 
)
Page.set_viewport_size

In the case of multiple pages in a single browser, each page can have its own viewport size. However,
`browser.new_context()` allows to set viewport size (and more) for all pages in the context at once.

`page.set_viewport_size()` will resize the page. A lot of websites don't expect phones to change size, so you
should set the viewport size before navigating to the page. `page.set_viewport_size()` will also reset
`screen` size, use `browser.new_context()` with `screen` and `viewport` parameters if you need better
control of these properties.

**Usage**

```py
page = browser.new_page()
page.set_viewport_size({\"width\": 640, \"height\": 480})
page.goto(\"https://example.com\")
```

Parameters
----------
viewport_size : {width: int, height: int}

◆ tap()

None playwright.sync_api._generated.Page.tap (   self,
str  selector,
*typing.Optional[ typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]] ]   modifiers = None,
typing.Optional[Position]   position = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None 
)
Page.tap

This method taps an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.touchscreen` to tap the center of the element, or the specified `position`.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

**NOTE** `page.tap()` the method will throw if `hasTouch` option of the browser context is false.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
    Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
    current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
    "Control" on Windows and Linux and to "Meta" on macOS.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
    `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
    are pressed.

◆ text_content()

typing.Optional[str] playwright.sync_api._generated.Page.text_content (   self,
str  selector,
*typing.Optional[bool]   strict = None,
typing.Optional[float]   timeout = None 
)
Page.text_content

Returns `element.textContent`.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.

Returns
-------
Union[str, None]

◆ title()

str playwright.sync_api._generated.Page.title (   self)
Page.title

Returns the page's title.

Returns
-------
str

◆ touchscreen()

"Touchscreen" playwright.sync_api._generated.Page.touchscreen (   self)
Page.touchscreen

Returns
-------
Touchscreen

◆ type()

None playwright.sync_api._generated.Page.type (   self,
str  selector,
str  text,
*typing.Optional[float]   delay = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None 
)
Page.type

Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to
send fine-grained keyboard events. To fill values in form fields, use `page.fill()`.

To press a special key, like `Control` or `ArrowDown`, use `keyboard.press()`.

**Usage**

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
text : str
    A text to type into a focused element.
delay : Union[float, None]
    Time to wait between key presses in milliseconds. Defaults to 0.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

◆ uncheck()

None playwright.sync_api._generated.Page.uncheck (   self,
str  selector,
*typing.Optional[Position]   position = None,
typing.Optional[float]   timeout = None,
typing.Optional[bool]   force = None,
typing.Optional[bool]   no_wait_after = None,
typing.Optional[bool]   strict = None,
typing.Optional[bool]   trial = None 
)
Page.uncheck

This method unchecks an element matching `selector` by performing the following steps:
1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is
   already unchecked, this method returns immediately.
1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
   the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use `page.mouse` to click in the center of the element.
1. Ensure that the element is now unchecked. If not, this method throws.

When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
Passing zero timeout disables this.

Parameters
----------
selector : str
    A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
    used.
position : Union[{x: float, y: float}, None]
    A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
    the element.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
force : Union[bool, None]
    Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
no_wait_after : Union[bool, None]
    This option has no effect.
    Deprecated: This option has no effect.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.
trial : Union[bool, None]
    When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
    to `false`. Useful to wait until the element is ready for the action without performing it.

◆ unroute()

None playwright.sync_api._generated.Page.unroute (   self,
typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]]  url,
typing.Optional[ typing.Union[ typing.Callable[["Route"], typing.Any], typing.Callable[["Route", "Request"], typing.Any], ] ]   handler = None 
)
Page.unroute

Removes a route created with `page.route()`. When `handler` is not specified, removes all routes for the
`url`.

Parameters
----------
url : Union[Callable[[str], bool], Pattern[str], str]
    A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
handler : Union[Callable[[Route, Request], Any], Callable[[Route], Any], None]
    Optional handler function to route the request.

◆ unroute_all()

None playwright.sync_api._generated.Page.unroute_all (   self,
*typing.Optional[Literal["default", "ignoreErrors", "wait"]]   behavior = None 
)
Page.unroute_all

Removes all routes created with `page.route()` and `page.route_from_har()`.

Parameters
----------
behavior : Union["default", "ignoreErrors", "wait", None]
    Specifies whether to wait for already running handlers and what to do if they throw errors:
    - `'default'` - do not wait for current handler calls (if any) to finish, if unrouted handler throws, it may
      result in unhandled error
    - `'wait'` - wait for current handler calls (if any) to finish
    - `'ignoreErrors'` - do not wait for current handler calls (if any) to finish, all errors thrown by the handlers
      after unrouting are silently caught

◆ url()

str playwright.sync_api._generated.Page.url (   self)
Page.url

Returns
-------
str

◆ video()

typing.Optional["Video"] playwright.sync_api._generated.Page.video (   self)
Page.video

Video object associated with this page.

Returns
-------
Union[Video, None]

◆ viewport_size()

typing.Optional[ViewportSize] playwright.sync_api._generated.Page.viewport_size (   self)
Page.viewport_size

Returns
-------
Union[{width: int, height: int}, None]

◆ wait_for_event()

typing.Any playwright.sync_api._generated.Page.wait_for_event (   self,
str  event,
typing.Optional[typing.Callable]   predicate = None,
*typing.Optional[float]   timeout = None 
)
Page.wait_for_event

**NOTE** In most cases, you should use `page.expect_event()`.

Waits for given `event` to fire. If predicate is provided, it passes event's value into the `predicate` function
and waits for `predicate(event)` to return a truthy value. Will throw an error if the page is closed before the
`event` is fired.

Parameters
----------
event : str
    Event name, same one typically passed into `*.on(event)`.
predicate : Union[Callable, None]
    Receives the event data and resolves to truthy value when the waiting should resolve.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()`.

Returns
-------
Any

◆ wait_for_function()

"JSHandle" playwright.sync_api._generated.Page.wait_for_function (   self,
str  expression,
*typing.Optional[typing.Any]   arg = None,
typing.Optional[float]   timeout = None,
typing.Optional[typing.Union[float, Literal["raf"]]]   polling = None 
)
Page.wait_for_function

Returns when the `expression` returns a truthy value. It resolves to a JSHandle of the truthy value.

**Usage**

The `page.wait_for_function()` can be used to observe viewport size change:

```py
from playwright.sync_api import sync_playwright, Playwright

def run(playwright: Playwright):
    webkit = playwright.webkit
    browser = webkit.launch()
    page = browser.new_page()
    page.evaluate(\"window.x = 0; setTimeout(() => { window.x = 100 }, 1000);\")
    page.wait_for_function(\"() => window.x > 0\")
    browser.close()

with sync_playwright() as playwright:
    run(playwright)
```

To pass an argument to the predicate of `page.wait_for_function()` function:

```py
selector = \".foo\"
page.wait_for_function(\"selector => !!document.querySelector(selector)\", selector)
```

Parameters
----------
expression : str
    JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the
    function is automatically invoked.
arg : Union[Any, None]
    Optional argument to pass to `expression`.
timeout : Union[float, None]
    Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
    default value can be changed by using the `browser_context.set_default_timeout()` or
    `page.set_default_timeout()` methods.
polling : Union["raf", float, None]
    If `polling` is `'raf'`, then `expression` is constantly executed in `requestAnimationFrame` callback. If `polling`
    is a number, then it is treated as an interval in milliseconds at which the function would be executed. Defaults to
    `raf`.

Returns
-------
JSHandle

◆ wait_for_load_state()

None playwright.sync_api._generated.Page.wait_for_load_state (   self,
typing.Optional[ Literal["domcontentloaded", "load", "networkidle"] ]   state = None,
*typing.Optional[float]   timeout = None 
)
Page.wait_for_load_state

Returns when the required load state has been reached.

This resolves when the page reaches a required load state, `load` by default. The navigation must have been
committed when this method is called. If current document has already reached the required state, resolves
immediately.

**NOTE** Most of the time, this method is not needed because Playwright
[auto-waits before every action](https://playwright.dev/python/docs/actionability).

**Usage**

```py
page.get_by_role(\"button\").click() # click triggers navigation.
page.wait_for_load_state() # the promise resolves after \"load\" event.
```

```py
with page.expect_popup() as page_info:
    page.get_by_role(\"button\").click() # click triggers a popup.
popup = page_info.value
# Wait for the \"DOMContentLoaded\" event.
popup.wait_for_load_state(\"domcontentloaded\")
print(popup.title()) # popup is ready to use.
```

Parameters
----------
state : Union["domcontentloaded", "load", "networkidle", None]
    Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current
    document, the method resolves immediately. Can be one of:
    - `'load'` - wait for the `load` event to be fired.
    - `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
    - `'networkidle'` - **DISCOURAGED** wait until there are no network connections for at least `500` ms. Don't use
      this method for testing, rely on web assertions to assess readiness instead.
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.

◆ wait_for_selector()

typing.Optional["ElementHandle"] playwright.sync_api._generated.Page.wait_for_selector (   self,
str  selector,
*typing.Optional[float]   timeout = None,
typing.Optional[ Literal["attached", "detached", "hidden", "visible"] ]   state = None,
typing.Optional[bool]   strict = None 
)
Page.wait_for_selector

Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
`detached`.

**NOTE** Playwright automatically waits for element to be ready before performing an action. Using `Locator`
objects and web-first assertions makes the code wait-for-selector-free.

Wait for the `selector` to satisfy `state` option (either appear/disappear from dom, or become visible/hidden). If
at the moment of calling the method `selector` already satisfies the condition, the method will return immediately.
If the selector doesn't satisfy the condition for the `timeout` milliseconds, the function will throw.

**Usage**

This method works across navigations:

```py
from playwright.sync_api import sync_playwright, Playwright

def run(playwright: Playwright):
    chromium = playwright.chromium
    browser = chromium.launch()
    page = browser.new_page()
    for current_url in [\"https://google.com\", \"https://bbc.com\"]:
        page.goto(current_url, wait_until=\"domcontentloaded\")
        element = page.wait_for_selector(\"img\")
        print(\"Loaded image: \" + str(element.get_attribute(\"src\")))
    browser.close()

with sync_playwright() as playwright:
    run(playwright)
```

Parameters
----------
selector : str
    A selector to query for.
timeout : Union[float, None]
    Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
state : Union["attached", "detached", "hidden", "visible", None]
    Defaults to `'visible'`. Can be either:
    - `'attached'` - wait for element to be present in DOM.
    - `'detached'` - wait for element to not be present in DOM.
    - `'visible'` - wait for element to have non-empty bounding box and no `visibility:hidden`. Note that element
      without any content or with `display:none` has an empty bounding box and is not considered visible.
    - `'hidden'` - wait for element to be either detached from DOM, or have an empty bounding box or
      `visibility:hidden`. This is opposite to the `'visible'` option.
strict : Union[bool, None]
    When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
    element, the call throws an exception.

Returns
-------
Union[ElementHandle, None]

◆ wait_for_timeout()

None playwright.sync_api._generated.Page.wait_for_timeout (   self,
float  timeout 
)
Page.wait_for_timeout

Waits for the given `timeout` in milliseconds.

Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going
to be flaky. Use signals such as network events, selectors becoming visible and others instead.

**Usage**

```py
# wait for 1 second
page.wait_for_timeout(1000)
```

Parameters
----------
timeout : float
    A timeout to wait for

◆ wait_for_url()

None playwright.sync_api._generated.Page.wait_for_url (   self,
typing.Union[str, typing.Pattern[str], typing.Callable[[str], bool]]  url,
*typing.Optional[ Literal["commit", "domcontentloaded", "load", "networkidle"] ]   wait_until = None,
typing.Optional[float]   timeout = None 
)
Page.wait_for_url

Waits for the main frame to navigate to the given URL.

**Usage**

```py
page.click(\"a.delayed-navigation\") # clicking the link will indirectly cause a navigation
page.wait_for_url(\"**/target.html\")
```

Parameters
----------
url : Union[Callable[[str], bool], Pattern[str], str]
    A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. Note that if
    the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly
    equal to the string.
wait_until : Union["commit", "domcontentloaded", "load", "networkidle", None]
    When to consider operation succeeded, defaults to `load`. Events can be either:
    - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
    - `'load'` - consider operation to be finished when the `load` event is fired.
    - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
      at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    - `'commit'` - consider operation to be finished when network response is received and the document started
      loading.
timeout : Union[float, None]
    Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can
    be changed by using the `browser_context.set_default_navigation_timeout()`,
    `browser_context.set_default_timeout()`, `page.set_default_navigation_timeout()` or
    `page.set_default_timeout()` methods.

◆ workers()

typing.List["Worker"] playwright.sync_api._generated.Page.workers (   self)
Page.workers

This method returns all of the dedicated
[WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page.

**NOTE** This does not contain ServiceWorkers

Returns
-------
List[Worker]

The documentation for this class was generated from the following file: