使用xpath或ruby capybara代码查找元素中是否存在特定文本

时间:2014-02-11 05:13:45

标签: xpath capybara

我正在使用测试自动化。因为我正在使用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>

在这里,我想查看您的订单所在的文本,但还需要一个步骤来完成它。是否存在。

1 个答案:

答案 0 :(得分:1)

如果文本包含给定的字符串

,则以下xpath应返回true
//h3[contains(., "Your order is placed")]=true()
相关问题