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

Method click

playwright/async_api/_generated.py:10833–10915  ·  view source on GitHub ↗

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

(
        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,
        trial: typing.Optional[bool] = None,
        strict: typing.Optional[bool] = None,
    )

Source from the content-addressed store, hash-verified

10831 return mapping.from_maybe_impl(self._impl_obj.is_closed())
10832
10833 async def click(
10834 self,
10835 selector: str,
10836 *,
10837 modifiers: typing.Optional[
10838 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
10839 ] = None,
10840 position: typing.Optional[Position] = None,
10841 delay: typing.Optional[float] = None,
10842 button: typing.Optional[Literal["left", "middle", "right"]] = None,
10843 click_count: typing.Optional[int] = None,
10844 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
10845 force: typing.Optional[bool] = None,
10846 no_wait_after: typing.Optional[bool] = None,
10847 trial: typing.Optional[bool] = None,
10848 strict: typing.Optional[bool] = None,
10849 ) -> None:
10850 """Page.click
10851
10852 This method clicks an element matching `selector` by performing the following steps:
10853 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
10854 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
10855 the element is detached during the checks, the whole action is retried.
10856 1. Scroll the element into view if needed.
10857 1. Use `page.mouse` to click in the center of the element, or the specified `position`.
10858 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
10859
10860 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
10861 Passing zero timeout disables this.
10862
10863 Parameters
10864 ----------
10865 selector : str
10866 A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
10867 used.
10868 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
10869 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
10870 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
10871 "Control" on Windows and Linux and to "Meta" on macOS.
10872 position : Union[{x: float, y: float}, None]
10873 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
10874 the element.
10875 delay : Union[float, None]
10876 Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
10877 button : Union["left", "middle", "right", None]
10878 Defaults to `left`.
10879 click_count : Union[int, None]
10880 defaults to 1. See [UIEvent.detail].
10881 timeout : Union[float, None]
10882 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
10883 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
10884 force : Union[bool, None]
10885 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
10886 no_wait_after : Union[bool, None]
10887 Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
10888 can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
10889 navigating to inaccessible pages. Defaults to `false`.
10890 Deprecated: This option will default to `true` in the future.

Callers 4

clickMethod · 0.45
clickMethod · 0.45
clickMethod · 0.45
clickMethod · 0.45

Calls 3

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
to_implMethod · 0.80

Tested by

no test coverage detected