B. The form does not have a field labeled 'Username'
C. The button 'Submit' is missing from the page
D. You forgot to call visit before fill_in
Solution
Step 1: Understand Capybara::ElementNotFound meaning
This error means Capybara could not find the form field or button with given label.
Step 2: Check test code and error cause
Since visit is called, the likely cause is the field labeled 'Username' does not exist on the page.
Final Answer:
The form does not have a field labeled 'Username' -> Option B
Quick Check:
ElementNotFound = missing field or button [OK]
Hint: Check labels exactly match form fields and buttons [OK]
Common Mistakes:
Assuming visit was not called when it was
Thinking Capybara lacks fill_in support
Ignoring exact label spelling and case
5. You want to write a system test that logs in a user, visits their profile page, and verifies their username is shown. Which sequence correctly uses Capybara commands?