Watir 检查文本存在

mat*_*ock 3 ruby rspec watir assertion watir-webdriver

我得到它不是 Watir 结合 rspec 找到我的文本。以下代码导致此错误。

  1. 代码:browser.text.include?("Coverberechnung").should == true
  2. 错误 1: expected: true got: false (using ==)
  3. 错误2: Using should from rspec-expectations' old :should syntax without explicitly enabling the syntax is deprecated. Use the new :expect syntax or explicitly enable :should instead. Called from

也许我可以帮忙

该站点的 URL:在此处输入链接描述

ord*_*rde 5

您正在寻找初始大写的字符串(即Coverberechnung),但该字符串在测试站点上全部大写(即COVERBERECHNUNG)。

尝试:

browser.text.include?("COVERBERECHNUNG").should == true

或(使用期望语法)

expect(browser.text.include?("COVERBERECHNUNG")).to be true