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

检查页面标题是否包含Cucumber和Watir中的字符串,cucumber,automated-tests,watir-webdriver,Cucumber,Automated Tests,Watir Webdriver,我正在使用Watir和Cucumber进行测试,我想检查页面的标题是否包含一些给定的字符串 我试过: Then(/^the title page should include (.*)$/) do |title| @browser.title.include?title @browser.close end 但是不起作用。有什么想法吗?我找到了答案 1.gem安装rspec期望值。 2.在.rb文件中添加需要的“rspec/expections” 3.期望(

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

我试过:

    Then(/^the title page should include (.*)$/) do |title|
     @browser.title.include?title
     @browser.close
    end
但是不起作用。有什么想法吗?

我找到了答案 1.gem安装rspec期望值。 2.在.rb文件中添加需要的“rspec/expections”
3.期望(@browser.title)。包括(title)

我找到了答案。1.gem安装rspec期望值。2.in.rb文件添加要求“rspec/expections”3。期望(@browser.title)。包括(title)你能发布你的解决方案作为答案吗请选择它作为这个问题的答案。它会关闭此功能,从而更容易阅读代码:)