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

Method click

playwright/async_api/_generated.py:2270–2345  ·  view source on GitHub ↗

ElementHandle.click This method clicks the element by performing the following steps: 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the element, unless `force` option is set. 1. Scroll the element into view if needed. 1. Use

(
        self,
        *,
        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,
        steps: typing.Optional[int] = None,
    )

Source from the content-addressed store, hash-verified

2268 )
2269
2270 async def click(
2271 self,
2272 *,
2273 modifiers: typing.Optional[
2274 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
2275 ] = None,
2276 position: typing.Optional[Position] = None,
2277 delay: typing.Optional[float] = None,
2278 button: typing.Optional[Literal["left", "middle", "right"]] = None,
2279 click_count: typing.Optional[int] = None,
2280 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
2281 force: typing.Optional[bool] = None,
2282 no_wait_after: typing.Optional[bool] = None,
2283 trial: typing.Optional[bool] = None,
2284 steps: typing.Optional[int] = None,
2285 ) -> None:
2286 """ElementHandle.click
2287
2288 This method clicks the element by performing the following steps:
2289 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the element, unless `force` option is set.
2290 1. Scroll the element into view if needed.
2291 1. Use `page.mouse` to click in the center of the element, or the specified `position`.
2292 1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
2293
2294 If the element is detached from the DOM at any moment during the action, this method throws.
2295
2296 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
2297 Passing zero timeout disables this.
2298
2299 Parameters
2300 ----------
2301 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
2302 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
2303 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
2304 "Control" on Windows and Linux and to "Meta" on macOS.
2305 position : Union[{x: float, y: float}, None]
2306 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
2307 the element.
2308 delay : Union[float, None]
2309 Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
2310 button : Union["left", "middle", "right", None]
2311 Defaults to `left`.
2312 click_count : Union[int, None]
2313 defaults to 1. See [UIEvent.detail].
2314 timeout : Union[float, None]
2315 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
2316 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
2317 force : Union[bool, None]
2318 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
2319 no_wait_after : Union[bool, None]
2320 Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You
2321 can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as
2322 navigating to inaccessible pages. Defaults to `false`.
2323 Deprecated: This option will default to `true` in the future.
2324 trial : Union[bool, None]
2325 When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
2326 to `false`. Useful to wait until the element is ready for the action without performing it.
2327 steps : Union[int, None]

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