grafana/k6 · error

checking element is editable: %w

Error message

checking element is editable: %w

What it means

Returned by ElementHandle.isEditable() when the state probe fails with a non-timeout error. Timeout results are deliberately ignored (they simply mean 'not editable yet'), so this error indicates a stale handle, a destroyed execution context (navigation), a CDP failure, or a closed page/browser.

Source

Thrown at internal/js/modules/k6/browser/common/element_handle.go:1080

}

// IsDisabled checks if the element is disabled.
func (h *ElementHandle) IsDisabled() (bool, error) {
	ok, err := h.isDisabled(h.ctx, 0)
	// We don't care anout timeout errors here!
	if err != nil && !errors.Is(err, ErrTimedOut) {
		return false, fmt.Errorf("checking element is disabled: %w", err)
	}

	return ok, nil
}

// IsEditable checks if the element is editable.
func (h *ElementHandle) IsEditable() (bool, error) {
	ok, err := h.isEditable(h.ctx, 0)
	// We don't care anout timeout errors here!
	if err != nil && !errors.Is(err, ErrTimedOut) {
		return false, fmt.Errorf("checking element is editable: %w", err)
	}

	return ok, nil
}

// IsEnabled checks if the element is enabled.
func (h *ElementHandle) IsEnabled() (bool, error) {
	ok, err := h.isEnabled(h.ctx, 0)
	// We don't care anout timeout errors here!
	if err != nil && !errors.Is(err, ErrTimedOut) {
		return false, fmt.Errorf("checking element is enabled: %w", err)
	}

	return ok, nil
}

// IsHidden checks if the element is hidden.
func (h *ElementHandle) IsHidden() (bool, error) {

View on GitHub (pinned to 93accf6570)

Solutions

  1. Re-query the handle immediately before isEditable()
  2. Wait for the element: page.waitForSelector(sel, { state: 'attached' })
  3. Verify the page is alive before the probe
  4. Handle the thrown error separately from a false result

Example fix

// before
const editable = await h.isEditable(); // stale handle
// after
const el = await page.$('#notes');
const editable = await el.isEditable();
Defensive patterns

Strategy: try-catch

Validate before calling

const el = await page.$('#notes');
if (el && (await el.isVisible())) {
  const editable = await el.isEditable();
}

Try / catch

try {
  return await handle.isEditable();
} catch (e) {
  if (String(e).includes('checking element is editable')) {
    const fresh = await page.$(sel);
    return fresh ? fresh.isEditable() : false;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling isEditable() on a detached or pre-navigation handle; while the page is navigating; after page.close(); when the browser process has crashed or the session dropped.

Common situations: Form fields re-rendered by frameworks between query and probe; probing editability immediately after submit navigates away; racing browser shutdown.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/d095d87f7459c43c. Report an issue: GitHub.