Skip to content

Commit

Permalink
autoload all browser specific classes to fix circular dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Jun 28, 2019
1 parent 6bb1875 commit 51fb633
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion rb/lib/selenium/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def download(required_version)
segment_count += 1

if (segment_count % 15).zero?
percent = (progress.to_f / total.to_f) * 100
percent = progress.fdiv(total) * 100
print "#{CL_RESET}Downloading #{download_file_name}: #{percent.to_i}% (#{progress} / #{total})"
segment_count = 0
end
Expand Down
13 changes: 6 additions & 7 deletions rb/lib/selenium/webdriver/chrome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@

require 'net/http'

require 'selenium/webdriver/chrome/driver'
require 'selenium/webdriver/chrome/profile'
require 'selenium/webdriver/chrome/options'

module Selenium
module WebDriver
module Chrome
autoload :Bridge, 'selenium/webdriver/chrome/bridge'
autoload :Driver, 'selenium/webdriver/chrome/driver'
autoload :Profile, 'selenium/webdriver/chrome/profile'
autoload :Options, 'selenium/webdriver/chrome/options'
autoload :Service, 'selenium/webdriver/chrome/service'

def self.driver_path=(path)
WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome#driver_path=',
'Selenium::WebDriver::Chrome::Service#driver_path='
Expand All @@ -49,6 +51,3 @@ def self.path
end # Chrome
end # WebDriver
end # Selenium

require 'selenium/webdriver/chrome/service'
require 'selenium/webdriver/chrome/bridge'
20 changes: 10 additions & 10 deletions rb/lib/selenium/webdriver/edge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@

require 'net/http'

require 'selenium/webdriver/edge_html/driver'
require 'selenium/webdriver/edge_html/options'
require 'selenium/webdriver/edge_chrome/bridge'
require 'selenium/webdriver/edge_chrome/driver'
require 'selenium/webdriver/edge_chrome/profile'
require 'selenium/webdriver/edge_chrome/options'

module Selenium
module WebDriver
module EdgeHtml
autoload :Driver, 'selenium/webdriver/edge_html/driver'
autoload :Options, 'selenium/webdriver/edge_html/options'
autoload :Service, 'selenium/webdriver/edge_html/service'

def self.driver_path=(path)
WebDriver.logger.deprecate 'Selenium::WebDriver::Edge#driver_path=',
'Selenium::WebDriver::Edge::Service#driver_path='
Expand All @@ -43,6 +40,12 @@ def self.driver_path
end # EdgeHtml

module EdgeChrome
autoload :Bridge, 'selenium/webdriver/edge_chrome/bridge'
autoload :Driver, 'selenium/webdriver/edge_chrome/driver'
autoload :Profile, 'selenium/webdriver/edge_chrome/profile'
autoload :Options, 'selenium/webdriver/edge_chrome/options'
autoload :Service, 'selenium/webdriver/edge_chrome/service'

def self.path=(path)
Platform.assert_executable path
@path = path
Expand All @@ -56,6 +59,3 @@ def self.path
Edge = EdgeHtml # Alias EdgeHtml as Edge for now
end # WebDriver
end # Selenium

require 'selenium/webdriver/edge_html/service'
require 'selenium/webdriver/edge_chrome/service'
21 changes: 9 additions & 12 deletions rb/lib/selenium/webdriver/firefox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@
require 'socket'
require 'rexml/document'

require 'selenium/webdriver/firefox/driver'

require 'selenium/webdriver/firefox/extension'
require 'selenium/webdriver/firefox/binary'
require 'selenium/webdriver/firefox/profiles_ini'
require 'selenium/webdriver/firefox/profile'
require 'selenium/webdriver/firefox/bridge'
require 'selenium/webdriver/firefox/driver'
require 'selenium/webdriver/firefox/options'

module Selenium
module WebDriver
module Firefox
autoload :Extension, 'selenium/webdriver/firefox/extension'
autoload :Binary, 'selenium/webdriver/firefox/binary'
autoload :ProfilesIni, 'selenium/webdriver/firefox/profiles_ini'
autoload :Profile, 'selenium/webdriver/firefox/profile'
autoload :Bridge, 'selenium/webdriver/firefox/bridge'
autoload :Driver, 'selenium/webdriver/firefox/driver'
autoload :Options, 'selenium/webdriver/firefox/options'
autoload :Service, 'selenium/webdriver/firefox/service'

DEFAULT_PORT = 7055
DEFAULT_ENABLE_NATIVE_EVENTS = Platform.os == :windows
DEFAULT_SECURE_SSL = false
Expand All @@ -58,5 +57,3 @@ def self.path=(path)
end # Firefox
end # WebDriver
end # Selenium

require 'selenium/webdriver/firefox/service'
9 changes: 4 additions & 5 deletions rb/lib/selenium/webdriver/ie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
# specific language governing permissions and limitations
# under the License.

require 'selenium/webdriver/ie/driver'
require 'selenium/webdriver/ie/options'

module Selenium
module WebDriver
module IE
autoload :Driver, 'selenium/webdriver/ie/driver'
autoload :Options, 'selenium/webdriver/ie/options'
autoload :Service, 'selenium/webdriver/ie/service'

def self.driver_path=(path)
WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path=',
'Selenium::WebDriver::IE::Service#driver_path='
Expand All @@ -37,5 +38,3 @@ def self.driver_path
end # IE
end # WebDriver
end # Selenium

require 'selenium/webdriver/ie/service'
26 changes: 16 additions & 10 deletions rb/lib/selenium/webdriver/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@

require 'uri'

require 'selenium/webdriver/remote/bridge'
require 'selenium/webdriver/remote/driver'
require 'selenium/webdriver/remote/response'
require 'selenium/webdriver/remote/server_error'
require 'selenium/webdriver/remote/http/common'
require 'selenium/webdriver/remote/http/default'

require 'selenium/webdriver/remote/bridge'
require 'selenium/webdriver/remote/capabilities'
require 'selenium/webdriver/remote/commands'
module Selenium
module WebDriver
module Remote
autoload :Bridge, 'selenium/webdriver/remote/bridge'
autoload :Driver, 'selenium/webdriver/remote/driver'
autoload :Response, 'selenium/webdriver/remote/response'
autoload :ServerError, 'selenium/webdriver/remote/server_error'
autoload :Capabilities, 'selenium/webdriver/remote/capabilities'
autoload :COMMANDS, 'selenium/webdriver/remote/commands'
module Http
autoload :Common, 'selenium/webdriver/remote/http/common'
autoload :Default, 'selenium/webdriver/remote/http/default'
end
end
end
end
11 changes: 5 additions & 6 deletions rb/lib/selenium/webdriver/safari.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
# specific language governing permissions and limitations
# under the License.

require 'selenium/webdriver/safari/bridge'
require 'selenium/webdriver/safari/driver'
require 'selenium/webdriver/safari/options'

module Selenium
module WebDriver
module Safari
autoload :Bridge, 'selenium/webdriver/safari/bridge'
autoload :Driver, 'selenium/webdriver/safari/driver'
autoload :Options, 'selenium/webdriver/safari/options'
autoload :Service, 'selenium/webdriver/safari/service'

class << self
def technology_preview
"/Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver"
Expand Down Expand Up @@ -61,5 +62,3 @@ def driver_path
end # Safari
end # WebDriver
end # Selenium

require 'selenium/webdriver/safari/service'

0 comments on commit 51fb633

Please sign in to comment.