Note that there are some explanatory texts on larger screens.

plurals
  1. POWatir from Ruby on Rails controller
    primarykey
    data
    text
    <p>I have the requirement to run a Watir test code from the Ruby on Rails framework. My ruby on rails hello world works perfectly and so does my Watir test (when i run from the irb and when run as an individial ruby script ) , but my requirement is to call the watir code from within the rails controller, which is giving a cannot Load Watir error.</p> <p>This requirement is very urgent, and i can't figure out what the error is.</p> <p>Note: The rails application is run on the netbeans 6.9 IDE and uses the native ruby interpreter in the system (not the default jruby)</p> <p>I have the following versions: ruby : 1.9.3 watir : 3.0.0 Rails : 3.2.8</p> <pre><code>LoadError (cannot load such file -- Watir): app/controllers/watir_controller.rb:4:in `&lt;class:WatirController&gt;' app/controllers/watir_controller.rb:1:in `&lt;top (required)&gt;' </code></pre> <p>This is my controller class which calls the watir script:</p> <pre><code>class WatirController &lt; ApplicationController ## the Watir controller require 'rubygems' require 'watir' # set a variable test_site = "http://www.google.com" # open the IE browser ie = Watir::IE.new # print some comments puts "Beginning of test: Google search." puts " Step 1: go to the test site: " + test_site ie.goto test_site puts " Step 2: enter 'pickaxe' in the search text field." ie.text_field(:name, "q").set "pickaxe" # "q" is the name of the search field #puts " Step 3: click the 'Google Search' button." ie.button(:name, "btnG").click # "btnG" is the name of the Search button puts " Expected Result:" puts " A Google page with results should be shown. 'Programming Ruby' should be high on the list." puts " Actual Result:" if ie.text.include? "Programming Ruby" puts " Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results." else puts " Test Failed! Could not find: 'Programming Ruby'." end puts "End of test: Google search." end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload