clickOnElement

suspend fun PageSession.clickOnElement(selector: CssSelector, clickDuration: Duration = 100.milliseconds, mouseButton: MouseButton = MouseButton.left)(source)

Finds a DOM element via the given selector, and simulates a click event on it based on its padding box. The current tab doesn't need to be focused.

If this click opens a new tab, that new tab may become focused, but this session still targets the old tab.


suspend fun PageSession.clickOnElement(selector: CssSelector, clickDurationMillis: Long, mouseButton: MouseButton = MouseButton.left)(source)

Deprecated

Use clickOnElement with a Duration type for clickDuration.

Replace with

import kotlin.time.Duration.Companion.milliseconds
this.clickOnElement(selector, clickDurationMillis.milliseconds, mouseButton)

Finds a DOM element via the given selector, and simulates a click event on it based on its padding box. The current tab doesn't need to be focused.

If this click opens a new tab, that new tab may become focused, but this session still targets the old tab.