set_timeout($timeout)

Set the default timeout to $timeout.

pause($time)

wait_for_condition($condition, $timeout)

Wait for the given $condition sub to return a true value or $timeout to expire. Returns the return value of $condition or 0 on timeout.

$webkit->wait_for_condition(sub {
    $webkit->is_visible('id=foo');
}, 10000);

wait_for_element_present($locator, $timeout)

wait_for_element_to_disappear($locator, $timeout)

wait_for_page_to_load($timeout)

wait_for_pending_requests($timeout)

Waits for all pending requests to finish. This is most useful for AJAX applications, since wait_for_page_to_load does not wait for AJAX requests.

wait_for_alert($text, $timeout)

Wait for an alert with the given text to happen. If $text is undef, it waits for any alert. Since alerts do not get automatically cleared, this has to be done manually before causing the action that is supposed to throw a new alert:

$webkit->alerts([]);
$webkit->click('...');
$webkit->wait_for_alert;

prepare_async_page_reload

To be used in combination with wait_for_async_page_load. Use case: interaction that causes an ajax request that causes a page reload without any immediately visible changes.

$self->prepare_async_page_load;

<page interactions>

$self->wait_for_async_page_load;

wait_for_async_page_load

To be used in combination with prepare_async_page_load.

fire_event($locator, $event_type)