I want to run my scripts on both firefox and chrome at a time in rspec.
wanted to know is it possible ?
And My Driver.rb file looks like
RSpec.configure do |config|
config.before(:all) do
###############################################################################################################################################
####Running in Multiple browsers
###############################################################################################################################################
def firefox()
puts "begin firefox"
path = File.dirname(__FILE__) + "/driver/geckodriver"
begin
@driver = Selenium::WebDriver.for :firefox
puts "Starting tests, initializing " + @driver.inspect()
rescue Exception=>e
puts "Start Exception"
puts e.message
puts e.backtrace.inspect
raise e
end
@base_url = @test_env['url']
@driver.manage.window.maximize
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = DEFAULT_WAIT_TIME
end
def chrome
puts "begin chrome"
path = File.dirname(__FILE__) + "/../driver/chromedriver"
prefs = {:download => {:prompt_for_download => false, :default_directory
=> "#{ENV['PATH']}", :url => @base_url} }
@driver = Selenium::WebDriver.for :chrome, :prefs => prefs
@base_url = @test_env['url']
@accept_next_alert = true
end
begin
puts "begin firefox"
firefox
rescue Exception=>e
# Exception already displayed, exiting
puts "Exception Found: #{e}"
raise e
@driver.quit
end
config.after(:all) do
puts "Finishing tests, killing " + @driver.inspect()
@driver.quit
end
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/4162fee6-8dcf-4afe-ad13-9d986b2e20b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.