[rb] simplify the remote server code
@@ -102,28 +102,17 @@ module Selenium
end
def remote_server_jar
- local_selenium_jar = 'selenium_server_deploy.jar'
- downloaded_selenium_jar = "selenium-server-standalone-#{Selenium::Server.latest}.jar"
-
- directory_names = [
- root,
- root.join('rb'),
- root.join('build'),
- root.join('build/rb'),
- Pathname.new(Dir.pwd).join('rb')
- ]
- file_names = [local_selenium_jar, downloaded_selenium_jar]
- file_names.delete(local_selenium_jar) if ENV['DOWNLOAD_SERVER']
-
- files = file_names.each_with_object([]) do |file, array|
- directory_names.each { |dir| array << "#{dir}/#{file}" }
+ test_jar = "#{Pathname.new(Dir.pwd).join('rb')}/selenium_server_deploy.jar"
+ built_jar = root.join('bazel-bin/java/server/src/org/openqa/selenium/grid/selenium_server_deploy.jar')
+ jar = if File.exist?(test_jar) && ENV['DOWNLOAD_SERVER'].nil?
+ test_jar
+ elsif File.exist?(built_jar) && ENV['DOWNLOAD_SERVER'].nil?
+ built_jar
+ else
+ Selenium::Server.download(:latest)
end
- jar = files.find { |file| File.exist?(file) } ||
- Selenium::Server.download(:latest) && files.find { |file| File.exist?(file) }
-
WebDriver.logger.info "Server Location: #{jar}"
- puts "Server Location: #{jar}"
jar
end
