Sha256: 32882fc43c53867d453643f6551148500cd52155097ff1d00be19da8f2aa5b10
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
# Encoding: utf-8 # selenium connect class SeleniumConnect # Creates a server connection class Server attr_reader :configuration, :current_dir_path def initialize(configuration) @configuration = configuration @current_dir_path = File.join(File.dirname(File.expand_path(__FILE__))) end def start rake 'start' end def stop rake 'stop' end def restart rake 'restart' end private def get_rake_file rake_file_path = current_dir_path + '/rake.task' File.open(rake_file_path, 'w') do |file| file.puts "require 'selenium/rake/server_task'" file.puts 'Selenium::Rake::ServerTask.new(:server) do |t|' if configuration.jar file.puts "t.jar = '#{configuration.jar}'" else file.puts "t.jar = '#{current_dir_path + '/../../bin/selenium-server-standalone-2.35.0.jar'}'" end file.puts 't.background' if configuration.log file.puts "t.log = '#{File.join(Dir.getwd, configuration.log, 'server.log')}'" else file.puts 't.log = false' end file.puts "t.port = #{configuration.port}" opts = '' if configuration.browser == 'chrome' opts += '-Dwebdriver.chrome.driver=' + current_dir_path + '/../../bin/chromedriver' if configuration.log opts += ' -Dwebdriver.chrome.logfile=' + File.join(Dir.getwd, configuration.log, 'chrome.log') end file.puts "t.opts = %w[#{opts}]" end file.puts 'end' end rake_file_path end def rake(task) system "rake -f #{get_rake_file} server:#{task}" end end # Server end # SeleniumConnect
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
selenium-connect-3.7.0 | lib/selenium_connect/server.rb |
selenium-connect-3.6.0 | lib/selenium_connect/server.rb |