Skip to content

Commit e51e2a9

Browse files
committed
[rb] support initializing Server with args and log_level
1 parent b44aee0 commit e51e2a9

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

rb/lib/selenium/server.rb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,21 @@ def download_server(uri, destination)
182182
def initialize(jar, opts = {})
183183
raise Errno::ENOENT, jar unless File.exist?(jar)
184184

185-
@jar = jar
186-
@host = '127.0.0.1'
187-
@role = opts.fetch(:role, 'standalone')
188-
@port = opts.fetch(:port, 4444)
189-
@timeout = opts.fetch(:timeout, 30)
185+
@jar = jar
186+
@host = '127.0.0.1'
187+
@role = opts.fetch(:role, 'standalone')
188+
@port = opts.fetch(:port, 4444)
189+
@timeout = opts.fetch(:timeout, 30)
190190
@background = opts.fetch(:background, false)
191-
@log = opts[:log]
192-
@log_file = nil
193-
@additional_args = []
191+
@additional_args = opts.fetch(:args, [])
192+
@log = opts[:log]
193+
if opts[:log_level]
194+
@log ||= true
195+
@additional_args << '--log-level'
196+
@additional_args << opts[:log_level].to_s
197+
end
198+
199+
@log_file = nil
194200
end
195201

196202
def start

rb/spec/integration/selenium/webdriver/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
c.include(WebDriver::SpecSupport::Helpers)
3838

3939
c.before(:suite) do
40-
$DEBUG ||= ENV.fetch('DEBUG', nil) == 'true'
40+
WebDriver.logger
4141
GlobalTestEnv.remote_server.start if GlobalTestEnv.driver == :remote && ENV['WD_REMOTE_URL'].nil?
4242
GlobalTestEnv.print_env
4343
end

rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def remote_server
8585
@remote_server ||= Selenium::Server.new(
8686
remote_server_jar,
8787
port: PortProber.above(4444),
88-
log: $DEBUG,
88+
log_level: WebDriver.logger.debug? && 'FINE',
8989
background: true,
9090
timeout: 60
9191
)

0 commit comments

Comments
 (0)