- Published
- Author
- Nived HariSystem Analyst
By default, Capybara only finds visible and interactable elements. If a button is disabled or outside the viewport, Capybara may fail to locate it.
To fix this, use:
•
•
This is useful when testing UI behaviors where buttons are conditionally enabled/disabled or require scrolling to be visible.
#CU6U0R822 #capybara #C041BBLJ57G #specs
To fix this, use:
Code
expect(page).to have_button("Add Discrepancy", disabled: true, visible: :all)•
disabled: true ensures the button is actually disabled •
visible: :all allows Capybara to find buttons that are hidden, off-screen, or disabledThis is useful when testing UI behaviors where buttons are conditionally enabled/disabled or require scrolling to be visible.
#CU6U0R822 #capybara #C041BBLJ57G #specs