Posted By

noah on 02/08/10


Tagged

ajax javascript testing html ruby web dhtml doc BDD rake functional TDD automation Gem selenium selenium-rc rubygems proxy Task gems selenium-client Rakefile rc proxyinjection


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

t9md


Howto set up a Rake task to start and stop the Selenium-RC server


 / Published in: Ruby
 

URL: http://github.com/ph7/selenium-client

  1. require 'selenium/rake/tasks'
  2.  
  3. selenium_jar_file_path = 'selenium-server-1.0-beta-2/selenium-server.jar'
  4. selenium_server_log_path = "rc_at_#{Time.now.strftime "%C%y_%m_%d_%H%M%S"}.log"
  5. vanilla_selenium_server_log_path = "vanilla_rc_at_#{Time.now.strftime "%C%y_%m_%d_%H%M%S"}.log"
  6.  
  7. desc "start a selenium-rc server that can handle SSL and cross-domain requests"
  8.  
  9. Selenium::Rake::RemoteControlStartTask.new("rc:proxy") do |rc|
  10. rc.port = 4444
  11. rc.timeout_in_seconds = 2 * 60
  12. rc.background = true
  13. rc.wait_until_up_and_running = true
  14. rc.jar_file = selenium_jar_file_path
  15. rc.log_to = selenium_server_log_path
  16. rc.additional_args << "-proxyInjectionMode"
  17. rc.additional_args << "-trustAllSSLCertificates"
  18. rc.additional_args << "-avoidProxy"
  19. end
  20.  
  21. desc "start the selenium-rc server"
  22.  
  23. Selenium::Rake::RemoteControlStartTask.new("rc") do |rc|
  24. rc.port = 4444
  25. rc.timeout_in_seconds = 2 * 60
  26. rc.background = true
  27. rc.wait_until_up_and_running = true
  28. rc.jar_file = selenium_jar_file_path
  29. rc.log_to = vanilla_selenium_server_log_path
  30. end
  31.  
  32. Selenium::Rake::RemoteControlStopTask.new("rc:stop") do |rc|
  33. rc.host = "localhost"
  34. rc.port = 4444
  35. rc.timeout_in_seconds = 3 * 60
  36. end

Report this snippet  

You need to login to post a comment.