Skip to content

Commit

Permalink
Fix autoload of WebDriver::Remote::Bridge::COMMANDS
Browse files Browse the repository at this point in the history
COMMANDS is defined on WebDriver::Remote::Bridge, but is defined as an
autoload on WebDriver::Remote. Since it's used in
WebDriver::Remote::Bridge#commands (with all the namespaces nested),

Ruby will first look for the constant in WebDriver::Remote::Bridge, then
WebDriver::Remote, where it finds the autoload. It requires the file,
which defines WebDriver::Remote::Bridge::COMMANDS. Then Ruby emits a
warning, because it expected selenium/webdriver/remote/commands to
define WebDriver::Remote::COMMANDS, since that's what the autoload
declares. After that, the constant can be resolved so it still works.

This properly declares the constant as autoloaded under
WebDriver::Remote::Bridge.
  • Loading branch information
etiennebarrie authored and p0deje committed Jan 31, 2023
1 parent 20d68b3 commit 0e5bb5b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion rb/lib/selenium/webdriver/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module Remote
autoload :Driver, 'selenium/webdriver/remote/driver'
autoload :Response, 'selenium/webdriver/remote/response'
autoload :Capabilities, 'selenium/webdriver/remote/capabilities'
autoload :COMMANDS, 'selenium/webdriver/remote/commands'

module Http
autoload :Common, 'selenium/webdriver/remote/http/common'
Expand Down
1 change: 1 addition & 0 deletions rb/lib/selenium/webdriver/remote/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Selenium
module WebDriver
module Remote
class Bridge
autoload :COMMANDS, 'selenium/webdriver/remote/bridge/commands'
include Atoms

PORT = 4444
Expand Down

0 comments on commit 0e5bb5b

Please sign in to comment.