Taiko
Documentation

Home / API Reference

clear

Clears the value of given selector. If no selector is given clears the current active element.

Examples

await clear()
await clear(textBox({placeholder:'Email'}))
await clear(textBox({ placeholder: 'Email' }), { waitForNavigation: true, force: true })

Parameters


selector

A selector to search for element to clear. If there are multiple elements satisfying the selector, the first will be cleared.


options

Click options.


options.waitForNavigation boolean

Wait for navigation after clear. Default navigation timeout is 30 seconds, to override pass { navigationTimeout: 10000 } in options parameter.

Default value
true

options.waitForStart number

wait for navigation to start. Accepts time in milliseconds.

Default value
100

options.navigationTimeout number

Navigation timeout value in milliseconds for navigation after click.

Default value
30000

options.force boolean

Set to true to perform action on hidden/disabled elements.

Default value
false

options.waitForEvents Array<string>

Events available to wait for ['DOMContentLoaded', 'loadEventFired', 'networkAlmostIdle', 'networkIdle', 'firstPaint', 'firstContentfulPaint', 'firstMeaningfulPaint', 'targetNavigated']

Default value
[]

Returns

Promise<void>