Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a capybara matcher that checks that a div is empty?

I'm looking at the capybara matchers documentation: http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers

I can't seem to find way to check that a div is blank. I.e. I want to verify the presence of something like

<div class="test"></div>

I thought about assert_no_selector, but I don't think text nodes within a div show up. has_no_content doesn't seem to be working.

like image 741
ced Avatar asked Oct 26 '25 03:10

ced


1 Answers

you can access div content with find("#test").text

like image 198
Vadim Chumel Avatar answered Oct 28 '25 16:10

Vadim Chumel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!