teamcapybara/capybara · error · NotImplementedError

Getting visible text is not currently supported directly on

Error message

Getting visible text is not currently supported directly on shadow roots

What it means

Error "Getting visible text is not currently supported directly on shadow roots" thrown in teamcapybara/capybara.

Source

Thrown at lib/capybara/selenium/node.rb:15

# frozen_string_literal: true

# Selenium specific implementation of the Capybara::Driver::Node API

require 'capybara/selenium/extensions/find'
require 'capybara/selenium/extensions/scroll'
require 'capybara/node/whitespace_normalizer'

class Capybara::Selenium::Node < Capybara::Driver::Node
  include Capybara::Node::WhitespaceNormalizer
  include Capybara::Selenium::Find
  include Capybara::Selenium::Scroll

  def visible_text
    raise NotImplementedError, 'Getting visible text is not currently supported directly on shadow roots' if shadow_root?

    native.text
  end

  def all_text
    text = driver.evaluate_script('arguments[0].textContent', self) || ''
    normalize_spacing(text)
  end

  def [](name)
    native.attribute(name.to_s)
  rescue Selenium::WebDriver::Error::WebDriverError
    nil
  end

  def value
    if tag_name == 'select' && multiple?
      native.find_elements(:css, 'option:checked').map { |el| el[:value] || el.text }

View on GitHub (pinned to 15b5fdb76e)

When it happens

Trigger: Thrown at lib/capybara/selenium/node.rb:15 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of teamcapybara/capybara@15b5fdb76e (2026-08-21). Data as JSON: /api/errors/f61241e19eb54388. Report an issue: GitHub.