0

Iam working with test automation .for that am using ruby capybara to wite test scripts.Using

Ruby cabybara code i want to check a text is present is not inside dev element

how can i possible?

<div class="modal-header">
        <h3 class="orderCompleteNoEmailLabel">
            Your order is placed, but one more step is needed to complete it.
        </h3>  

</div>

Here i want to check the text Your order is placed, but one more step is needed to complete it. is present or not.

Sush
  • 1,449
  • 8
  • 26
  • 51

1 Answers1

1

Personally I would use this:

page.should have_css('div.modal-header', :text => "Your order is placed, but one more step is needed to complete it.")

you could also use:

page.should have_content('Your order is placed, but one more step is needed to complete it.')

Here is a link to a pretty useful list for capybara methods.

https://gist.github.com/zhengjia/428105

Dono
  • 656
  • 6
  • 12
  • I would like to add, its not great testing against actual text content on a page as that can (is very likely to) change which would therefore break the test. Agreed that you can just maintain your tests but say there are several areas that change at once? Just a tip. – Dono Feb 12 '14 at 14:11