MCPcopy Index your code
hub / github.com/microsoft/playwright-python / click

Method click

playwright/async_api/_generated.py:4447–4529  ·  view source on GitHub ↗

Frame.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/act

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

Source from the content-addressed store, hash-verified

4445 )
4446
4447 async def click(
4448 self,
4449 selector: str,
4450 *,
4451 modifiers: typing.Optional[
4452 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
4453 ] = None,
4454 position: typing.Optional[Position] = None,
4455 delay: typing.Optional[float] = None,
4456 button: typing.Optional[Literal["left", "middle", "right"]] = None,
4457 click_count: typing.Optional[int] = None,
4458 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
4459 force: typing.Optional[bool] = None,
4460 no_wait_after: typing.Optional[bool] = None,
4461 strict: typing.Optional[bool] = None,
4462 trial: typing.Optional[bool] = None,
4463 ) -> None:
4464 """Frame.click
4465
4466 This method clicks an element matching `selector` by performing the following steps:
4467 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
4468 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
4469 the element is detached during the checks, the whole action is retried.
4470 1. Scroll the element into view if needed.
4471 1. Use `page.mouse` to click in the center of the element, or the specified `position`.
4472 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
4473
4474 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
4475 Passing zero timeout disables this.
4476
4477 Parameters
4478 ----------
4479 selector : str
4480 A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
4481 used.
4482 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
4483 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
4484 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
4485 "Control" on Windows and Linux and to "Meta" on macOS.
4486 position : Union[{x: float, y: float}, None]
4487 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
4488 the element.
4489 delay : Union[float, None]
4490 Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
4491 button : Union["left", "middle", "right", None]
4492 Defaults to `left`.
4493 click_count : Union[int, None]
4494 defaults to 1. See [UIEvent.detail].
4495 timeout : Union[float, None]
4496 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
4497 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
4498 force : Union[bool, None]
4499 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
4500 no_wait_after : Union[bool, None]
4501 Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
4502 can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
4503 navigating to inaccessible pages. Defaults to `false`.
4504 Deprecated: This option will default to `true` in the future.

Callers

nothing calls this directly

Calls 4

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
to_implMethod · 0.80
clickMethod · 0.45

Tested by

no test coverage detected