Kga Agk
2009-Jul-01 12:43 UTC
[rspec-users] Selenium, Rspec in ruby. Start selenium server in code
I got it to work in ruby, but I have to start the selenium servver manualy before I runn the program. That is unesesary mutch work and complicated. Is there a way to start the selenium server inside the code and stop it at the end? Here is a code example i got to work... it is a bit messy require ''rubygems'' gem ''thoughtbot-shoulda'' require ''shoulda'' require ''spec'' require ''spec/story'' require ''test/unit'' require "rubygems" gem "selenium-client", ">=1.2.15" require "selenium/client" require "selenium" describe "test" do before :all do @browser = Selenium::Client::Driver.new \ :host => "localhost", :port => 4444, :browser => "*firefox", :url => "http://www.google.com", :timeout_in_second => 60 end after :all do @browser.close_current_browser_session end it "test1" do @browser.start_new_browser_session @browser.open "/" @browser.type "q", "Selenium seleniumhq.org" @browser.click "btnG", :wait_for => :page assert @browser.text?("seleniumhq.org") end end What do I need to add to get it to start the selenium server automaticly and stop it at the end? -- Posted via http://www.ruby-forum.com/.