I'm trying to search within a single table row for my cucumber test.
I have each row formatted like this:
%tr
%td= title
%td= complete
%td= goal
And I am looking to search within a row with a given title, and check the goal
Is there a simple way to accomplish this?
For anyone else who stumbles on this question, I think a better way to do this is:
find('tr', text: 'My title').should have_content(goal)
This way you're not adding a title attribute when it's not really needed
I would probably add an attribute to the td
you're interested in. Do something like:
%tr
%td{title= "#{title}"}= title
%td= complete
%td= goal
Then you can refer to this question on StackOverflow about finding within a specific element using css.
Capybara, finding within a css element
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With