Use Watir in Shoes (ruby)

393 Views Asked by At

I'm trying to do an application in ruby. I want to collect information from the user using some UI interface. Then use this info in my script to fill some form on a web page.

  • I use Shoes as UI
  • I use Watir as Browser "manager"

Here a simple sample of what i'm trying to do

Shoes.setup do
  gem 'watir' 
end

require 'watir'

Shoes.app do
  stack do
    edit_line do |e|
      @url = e.text
    end

    button("Test"){  
      browser = Watir::Browser.new
      browser.goto @url
      #Do some stuff
    }
  end
end

But then When the application start it's trying to installing watir and freeze because of error: http://screencast.com/t/XWmeMmPQEBc

2

There are 2 best solutions below

0
On BEST ANSWER

The error says that rake requires rubygems >= 1.3.2

You either need to upgrade rubygems or downgrade rake to a version compatible with your current rubygems.

Edit: or specifiy a version of watir that will run with an older rubygems & rake

0
On

Shoes has this problem with many native gems, i advise you to try this with green shoes

['rubygems','green_shoes','watir'].each(&method(:require))
Shoes.app do
  stack do
    Watir::Browser.default = 'ie'
    browser = Watir::Browser.new
    browser.goto 'http://bit.ly/watir-example'
    browser.text_field(:name => 'entry.0.single').set 'Watir'
    browser.text_field(:name => 'entry.1.single').set "I come here from Australia. \n The weather is great here."
    browser.radio(:value => 'Watir').set
    browser.button(:name => 'submit').click
  end
end