jeudi 16 mars 2017

Facing this issue @driver.quit giving error in after (:context ) in rspec

I am trying this

require 'rspec'
require 'selenium-webdriver'

RSpec.describe 'New test' do

  before :each do
    @driver = Selenium::WebDriver.for (:firefox)
  end

  after :all do
    @driver.quit
  end

  it 'should signup and create a new user' do
    p 'testing'
  end
end

And this is the error I get

rspec test.rb                                                                                                                     [13:04:18]
"testing"
.
An error occurred in an `after(:context)` hook.
Failure/Error: @driver.quit

NoMethodError:
  undefined method `quit' for nil:NilClass
# ./test.rb:11:in `block (2 levels) in <top (required)>'


Finished in 4.61 seconds (files took 0.17828 seconds to load)
1 example, 0 failures

I am sure it is a small thing that i am missing but could not find it any help would be appreciated.

Is this a FF or selenium version issue?

I am using FF 45 and selenium 2.53 and rspec 3.5.4.

Aucun commentaire:

Enregistrer un commentaire