Search code examples
rubyrspecwatirwatir-webdriverassertion

Watir Check Text exists


I get it not the Watir in conjunction with rspec find my text. The following code leads to this error.

  1. Code:browser.text.include?("Coverberechnung").should == true
  2. Error1: expected: true got: false (using ==)
  3. Error2: 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

Maybe I can have a help

URL for the Site: enter link description here


Solution

  • You're looking for an initially-capitalized string (i.e. Coverberechnung), but that string is all-capitalized on the test site (i.e. COVERBERECHNUNG).

    Try:

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

    or (using expect syntax)

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