Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get rid of the following warning: Problem while setting context on example startundefined local variable or method `selenium_driver'
    primarykey
    data
    text
    <p>Still making my first steps in Ruby (while dealing with some written code). I am getting the following warning each time I run <code>spec</code> (listed as is):</p> <pre><code>Problem while setting context on example startundefined local variable or method `selenium_driver' for #&lt;Spec::Example::ExampleGroup::Subclass_1::Subclass_1:0x7f2d2cd840e0&gt; </code></pre> <p>(<strong>Edit</strong>: Split into two lines, it says)</p> <pre><code>Problem while setting context on example start undefined local variable or method `selenium_driver' for #&lt;Spec::Example::ExampleGroup::Subclass_1::Subclass_1:0x7f2d2cd840e0&gt; </code></pre> <p>While <code>grep</code>-ing through Ruby code - could find the following:</p> <pre><code>/home/user/.rvm/gems/ruby-1.8.7-p334@frontend/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb: STDERR.puts "Problem while setting context on example start" + e </code></pre> <p>So here is the excerpt from the source code of <code>spec_helper.rb</code>:</p> <pre><code> config.append_before(:each) do begin if selenium_driver &amp;&amp; selenium_driver.session_started? selenium_driver.set_context "Starting example '#{self.description}'" end rescue Exception =&gt; e STDERR.puts "Problem while setting context on example start" + e end end </code></pre> <p>Kindly advise how can I solve the (potential) problem.</p> <p><strong>Update:</strong> This <code>grep</code> might be helpful as well:</p> <pre><code>user@vm-ubuntu:~/dev/branch/tests$ grep selenium_driver * my_module.rb: @selenium_driver = driver my_module.rb: ['TERM', 'INT'].each {|s| Signal.trap(s) { @selenium_driver.stop &amp;&amp; Process.exit(1) } } my_module.rb: return @selenium_driver </code></pre> <p><strong>Update N2:</strong> </p> <p>My <code>Gemfile</code>:</p> <pre><code>source "http://rubygems.org" # Default source gem "hpricot", "~&gt;0.8.4" gem "json", "~&gt;1.5.1" gem "rspec", "~&gt;1.3.2" gem "selenium-client", "~&gt;1.2.18" </code></pre> <p>My <code>selenium_helper.rb</code> file:</p> <pre><code>require 'selenium/client' require "selenium/rspec/spec_helper" ... </code></pre>
    singulars
    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