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

Method tap

playwright/async_api/_generated.py:10996–11065  ·  view source on GitHub ↗

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/actionab

(
        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

10994 )
10995
10996 async def tap(
10997 self,
10998 selector: str,
10999 *,
11000 modifiers: typing.Optional[
11001 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
11002 ] = None,
11003 position: typing.Optional[Position] = None,
11004 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
11005 force: typing.Optional[bool] = None,
11006 no_wait_after: typing.Optional[bool] = None,
11007 strict: typing.Optional[bool] = None,
11008 trial: typing.Optional[bool] = None,
11009 ) -> None:
11010 """Page.tap
11011
11012 This method taps an element matching `selector` by performing the following steps:
11013 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
11014 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
11015 the element is detached during the checks, the whole action is retried.
11016 1. Scroll the element into view if needed.
11017 1. Use `page.touchscreen` to tap the center of the element, or the specified `position`.
11018
11019 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
11020 Passing zero timeout disables this.
11021
11022 **NOTE** `page.tap()` will throw if the `hasTouch` option of the browser context is false.
11023
11024 Parameters
11025 ----------
11026 selector : str
11027 A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
11028 used.
11029 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
11030 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
11031 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
11032 "Control" on Windows and Linux and to "Meta" on macOS.
11033 position : Union[{x: float, y: float}, None]
11034 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
11035 the element.
11036 timeout : Union[float, None]
11037 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
11038 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
11039 force : Union[bool, None]
11040 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
11041 no_wait_after : Union[bool, None]
11042 This option has no effect.
11043 Deprecated: This option has no effect.
11044 strict : Union[bool, None]
11045 When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
11046 element, the call throws an exception.
11047 trial : Union[bool, None]
11048 When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
11049 to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
11050 `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
11051 are pressed.
11052 """
11053

Callers 4

tapMethod · 0.45
tapMethod · 0.45
tapMethod · 0.45
tapMethod · 0.45

Calls 3

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
to_implMethod · 0.80

Tested by

no test coverage detected