{"record":{"id":"61f3a23f84b4de13","repo":"teamcapybara/capybara","slug":"the-rack-test-driver-does-not-process-css","errorCode":null,"errorMessage":"The rack_test driver does not process CSS","messagePattern":"The rack_test driver does not process CSS","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"lib/capybara/rack_test/node.rb","lineNumber":24,"sourceCode":"class Capybara::RackTest::Node < Capybara::Driver::Node\n  include Capybara::Node::WhitespaceNormalizer\n\n  BLOCK_ELEMENTS = %w[p h1 h2 h3 h4 h5 h6 ol ul pre address blockquote dl div fieldset form hr noscript table].freeze\n\n  def all_text\n    normalize_spacing(native.text)\n  end\n\n  def visible_text\n    normalize_visible_spacing(displayed_text)\n  end\n\n  def [](name)\n    string_node[name]\n  end\n\n  def style(_styles)\n    raise NotImplementedError, 'The rack_test driver does not process CSS'\n  end\n\n  def value\n    string_node.value\n  end\n\n  def set(value, **options)\n    return if disabled? || readonly?\n\n    warn \"Options passed to Node#set but the RackTest driver doesn't support any - ignoring\" unless options.empty?\n\n    if value.is_a?(Array) && !multiple?\n      raise TypeError, \"Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}\"\n    end\n\n    if radio? then set_radio(value)\n    elsif checkbox? then set_checkbox(value)\n    elsif range? then set_range(value)","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/teamcapybara/capybara/blob/15b5fdb76e972e9623d5af2123ed3755594f9732/lib/capybara/rack_test/node.rb#L6-L42","documentation":"rack_test renders the page through Nokogiri without executing JavaScript or a styling engine, so it cannot compute CSS styles. Node#style therefore raises NotImplementedError. Every style API funnels here under rack_test: node.style(...), assert_style, the have_style matcher, and match_style.","triggerScenarios":"find('.modal').style('opacity'); expect(page).to have_style(opacity: '1'); expect(el).to match_style(display: 'block') - any of these while Capybara.current_driver is :rack_test.","commonSituations":"Speeding a suite up by moving specs from selenium to rack_test without removing style assertions; shared step definitions used under both drivers; asserting on classes/inline styles that only a real browser can resolve after JS runs.","solutions":["Run style specs under a JS-capable driver (selenium/cuprite) via a js: true tag or a dedicated driver-tagged describe block.","For statically present inline styles, assert on the attribute instead: expect(node[:style]).to include('color: red') or match a CSS attribute substring.","Guard the assertion by driver so it is skipped (or swapped) under rack_test.","Prefer asserting the classes/animations that produce styling, which rack_test can observe in the DOM."],"exampleFix":"# before\nexpect(page).to have_css('.modal', style: { 'opacity' => '1' }) # rack_test\n\n# after\nexpect(page).to have_css('.modal[style*=\\\"opacity: 1\\\"]')","handlingStrategy":"fallback","validationCode":"def style_checks_supported?\n  Capybara.current_driver != :rack_test\nend","typeGuard":"def style_capable_driver?\n  %i[selenium_chrome_headless selenium_chrome cuprite].include?(Capybara.current_driver)\nend","tryCatchPattern":"begin\n  expect(find('.modal')).to match_style(display: 'block')\nrescue NotImplementedError\n  expect(find('.modal')[:style]).to include('display: block') # static attribute fallback\nend","preventionTips":["Tag style specs js: true and run them under a JS driver; never assume rack_test computes styles.","For static markup, assert on the style attribute string, which every driver can read."],"tags":["ruby","capybara","rack-test","css","styles"],"backgroundTag":"unsupported-driver-operation","analyzedSha":"15b5fdb76e972e9623d5af2123ed3755594f9732","analyzedAt":"2026-08-21T16:53:45.588Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}