(from /home/chedong/.local/share/rdoc)
Capybara::RSpecMatchers::Matchers::HaveSibling — A matcher for checking if an element has a sibling that matches given criteria.
| Use Case | Command | Description |
|---|---|---|
| Check element has a sibling with specific text | expect(page).to have_sibling('Some text') | 🏷️ Verifies that the current element has a sibling element containing the exact text. |
| Check element has a sibling matching CSS selector | expect(page).to have_sibling('.my-class') | 🎯 Verifies that the current element has a sibling matching the given CSS selector. |
| Check element does not have a sibling | expect(page).to have_no_sibling('irrelevant') | 🚫 Verifies that the current element does not have a sibling matching the criteria. |
description — 📝 Returns a human-readable description of the matcher.element_does_not_match? — ❌ Checks if the actual element does not match the expected sibling condition (negative assertion).element_matches? — ✅ Checks if the actual element matches the expected sibling condition (positive assertion).query — 🔍 Returns the internal query object used to find the sibling.Note: This page is based on the original RDoc documentation. All emoji enhancements are added for scannability.
```Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-27 17:41 @216.73.216.199
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format