hubcap waitgone

Wait for an element to be removed from the DOM.

When to use

Use waitgone to block until an element matching a CSS selector is no longer present in the DOM. Use after dismissing dialogs or closing modals. Use wait to wait for an element to appear instead.

Usage

hubcap waitgone <selector> [--timeout <duration>]

Arguments

ArgumentTypeRequiredDescription
selectorstringYesCSS selector of the element to wait for removal

Flags

FlagTypeDefaultDescription
—timeoutduration30sMaximum wait time

Output

FieldTypeDescription
goneboolWhether the element was removed
selectorstringThe selector that was waited on
{"gone":true,"selector":".spinner"}

Errors

ConditionExit codeStderr
Missing selector argument1usage: hubcap waitgone <selector> [--timeout <duration>]
Chrome not connected2error: connecting to Chrome: ...
Element still present after timeout3error: timeout

Examples

Wait for a loading spinner to disappear:

hubcap waitgone '.spinner'

Wait for an overlay to be removed:

hubcap waitgone '#overlay' --timeout 15s

Dismiss a modal and wait for it to be removed (chaining):

hubcap click '.modal-close' && hubcap waitgone '.modal'

See also

  • wait - Wait for an element to appear in the DOM
  • waittext - Wait for text content to appear on the page
  • waitfn - Wait for a JavaScript expression to return truthy
  • exists - Check if an element exists without waiting