检查页面标题是否包含Cucumber和Watir中的某些字符串

时间:2015-10-02 06:46:50

标签: cucumber automated-tests watir-webdriver

我使用Watir和Cucumber进行测试,我想检查一个页面的标题是否包含一些给定的字符串。

我尝试过:

    Then(/^the title page should include (.*)$/) do |title|
     @browser.title.include?title
     @browser.close
    end

但不起作用。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我找到了答案  1.宝石安装rspec-expectations。  2.在.rb文件中添加要求" rspec /期望"  3.期望(@ browser.title)。包括(标题)