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

Method tap

playwright/async_api/_generated.py:4611–4680  ·  view source on GitHub ↗

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

(
        self,
        selector: str,
        *,
        modifiers: typing.Optional[
            typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
        ] = None,
        position: typing.Optional[Position] = 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

4609 )
4610
4611 async def tap(
4612 self,
4613 selector: str,
4614 *,
4615 modifiers: typing.Optional[
4616 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
4617 ] = None,
4618 position: typing.Optional[Position] = None,
4619 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
4620 force: typing.Optional[bool] = None,
4621 no_wait_after: typing.Optional[bool] = None,
4622 strict: typing.Optional[bool] = None,
4623 trial: typing.Optional[bool] = None,
4624 ) -> None:
4625 """Frame.tap
4626
4627 This method taps an element matching `selector` by performing the following steps:
4628 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
4629 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
4630 the element is detached during the checks, the whole action is retried.
4631 1. Scroll the element into view if needed.
4632 1. Use `page.touchscreen` to tap the center of the element, or the specified `position`.
4633
4634 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
4635 Passing zero timeout disables this.
4636
4637 **NOTE** `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.
4638
4639 Parameters
4640 ----------
4641 selector : str
4642 A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
4643 used.
4644 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
4645 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
4646 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
4647 "Control" on Windows and Linux and to "Meta" on macOS.
4648 position : Union[{x: float, y: float}, None]
4649 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
4650 the element.
4651 timeout : Union[float, None]
4652 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
4653 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
4654 force : Union[bool, None]
4655 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
4656 no_wait_after : Union[bool, None]
4657 This option has no effect.
4658 Deprecated: This option has no effect.
4659 strict : Union[bool, None]
4660 When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
4661 element, the call throws an exception.
4662 trial : Union[bool, None]
4663 When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
4664 to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
4665 `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
4666 are pressed.
4667 """
4668

Callers

nothing calls this directly

Calls 4

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
to_implMethod · 0.80
tapMethod · 0.45

Tested by

no test coverage detected