我正在使用测试自动化。因为我正在使用ruby capybara来测试脚本。使用
Ruby cabybara代码我想检查文本是否存在于dev元素内
我怎么可能?
<div class="modal-header">
<h3 class="orderCompleteNoEmailLabel">
Your order is placed, but one more step is needed to complete it.
</h3>
</div>
在这里,我想检查文本Your order is placed, but one more step is needed to complete it.
是否存在。
答案 0 :(得分:1)
我个人会用这个:
page.should have_css('div.modal-header', :text => "Your order is placed, but one more step is needed to complete it.")
你也可以使用:
page.should have_content('Your order is placed, but one more step is needed to complete it.')
这是一个链接到一个非常有用的capybara方法列表。