Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7729521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:59:20+00:00 2026-06-01T05:59:20+00:00

I’ve been trying to get started with Cucumber and Watir. I’ve done the installation

  • 0

I’ve been trying to get started with Cucumber and Watir. I’ve done the installation and written/copied a simple ‘feature’. However, I’m not getting anywhere with checking what’s on a page.

This my feature:

Feature: Search Google
In order to make sure people can find my documentation
I want to check it is listed on the first page in Google

Scenario: Searching for JS.Class docs
  Given I have opened "http://www.google.com/"
  When I search for "JS.Class"
  Then I should see a link to "http://jsclass.jcoglan.com/" with text "JS.Class v3.0"

My env.rb file looks like this

require 'watir'
require 'rspec'

And this is my search_steps.rb

@ie

Given /^I have opened "([^\"]*)"$/ do |url|
    @ie = Watir::IE.new
    @ie.goto(url)
end

When /^I search for "([^\"]*)"$/ do |arg1|
    @ie.text_field(:name, "q").set(arg1)
    @ie.button(:name, "btnG").click
end

Then /^I should see a link to "([^\"]*)" with text "([^\"]*)"$/ do |arg1, text|
    puts arg1

    # @ie.text.should include(arg1)
    @ie.close
end

When I uncomment the line ‘@ie.text.should include(arg1)’ I get this error thrown.

Then I should see a link to "http://jsclass.jcoglan.com/" with text "JS.Class v3.0" # features/step_definitions/search_steps.rb:13
  true
  undefined method `split' for ["http://jsclass.jcoglan.com/"]:Array (NoMethodError)
  ./features/step_definitions/search_steps.rb:17:in `/^I should see a link to "([^\"]*)" with text "([^\"]*)"$/'

  features\search.feature:8:in `Then I should see a link to "http://jsclass.jcoglan.com/" with text "JS.Class v3.0"'

Failing Scenarios:
cucumber features\search.feature:5 # Scenario: Searching for JS.Class docs

Right now the Then function isn’t doing its job. If I comment out the line then all it’s really doing is writing out some text.

The gems I have include the following cucumber <1.1.9>, rspec <2.9.0>, watir<2.0.4> and watir-webdriver <0.5.3>

The version of ruby I have is: ruby 1.9.3p125.

I’m running this on Windows 7 Ultimate.

I’m wondering if I’m missing a gem or something. Reading the message implies that I’m calling a method it can’t find but I’ve found quite a few pages on the web that use this method.

Any help, guidance or pointers in the right direction are gratefully welcomed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:59:21+00:00Added an answer on June 1, 2026 at 5:59 am

    The problem is that if you (manually) look at the text of the Google search results, you will noticed that there is no text “http://jsclass.jcoglan.com/”. So, as expected, the test will fail.

    To fix this, you can correct the call to the step by removing the ‘http://’:

    Then I should see a link to "jsclass.jcoglan.com/" with text "JS.Class v3.0"
    

    That said, it would be more robust if you actually make check for the link using the following code. Checking that the text is somewhere on the page can lead to false positives (see the latest post on WatirMelon)

    @ie.link(:url => arg1, :text => text).exists?.should be true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.