Sha256: 2662660d5af072aba83ded07d01725949661d4212f20c3cdef5219356ddd34c7
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module WatirSpec class RemoteServer attr_reader :server def start(port = 4444, args: []) require 'selenium/server' @server ||= Selenium::Server.new(jar, port: Selenium::WebDriver::PortProber.above(port), log: !!$DEBUG, background: true, timeout: 60) args.each { |arg| @server << arg } @server.start at_exit { @server.stop } end private def jar if ENV['LOCAL_SELENIUM'] local = File.expand_path('../selenium/buck-out/gen/java/server/src/org/openqa/grid/selenium/selenium.jar') end if File.exist?(ENV['REMOTE_SERVER_BINARY'] || '') ENV['REMOTE_SERVER_BINARY'] elsif ENV['LOCAL_SELENIUM'] && File.exist?(local) local elsif !Dir.glob('*selenium*.jar').empty? Dir.glob('*selenium*.jar').first else Selenium::Server.download :latest end rescue SocketError # not connected to internet raise Watir::Exception::Error, 'unable to find or download selenium-server-standalone jar' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
watir-6.14.0 | lib/watirspec/remote_server.rb |