So I’m trying to run this script
#!/usr/bin/env ruby
#sample ruby script using the selenium client
require “rubygems”
gem “selenium-webdriver”, “>=2.17.0”
require “selenium/webdriver”
begin
@browser = Selenium::Client::Driver.new
:host => “localhost”,
:port => 4444,
:browser => “*firefox”,
:url => “http://www.google.com”,
:timeout_in_second => 60
@browser.start_new_browser_session
@browser.open “/”
@browser.type “q”, “Selenium seleniumhq.org”
@browser.click “btnG”, :wait_for => :page
puts @browser.text? (“seleniumhq.org”)
ensure
@browser.close_current_browser_session
end
And I get this response when I run it.
seleniumtest_script.rb:24:in ensure in <main>': undefined method
close_current_browser_session’ for nil:NilClass (NoMethodError)
from seleniumtest_script.rb:24:in `’
So my question is, what am I missing?
Thanks in advance.