Document
Please don’t forget to check out the getting started page
Selenium Server
Besides giving you the ability to launch Selenium server with “selenium” command, Selenium Ruby also provides a driver
class, SeleniumDriver, that allows you to start server, check if server is running,
and stop server through ruby program.
require 'lib/selenium' require 'rake' require 'spec/rake/spectask' manager = Selenium::ServerManager.new(Selenium::SeleniumServer.new) task :default => [:acceptance_cycle] task :start_server do manager.start end task :stop_server do manager.stop end Spec::Rake::SpecTask.new('example') do |t| t.spec_files = FileList['selenium*example.rb'] end task :acceptance_cycle do begin Rake::Task['start_server'].invoke Rake::Task['example'].invoke ensure Rake::Task['stop_server'].invoke end end
Testing with Selenium
Action Based Testing
This is provided by Selenium project itself. The SeleniumDriver is bundled
with Selenium ruby gem. There is a more Ruby friendly class WebPage that you can check out as well.
Object Based Testing
Selenium Ruby provides a set of commonly used classes like Link, Button and
TextField that can help you build an object model that present your web application.
