class Selenium::WebDriver::DevTools
def method_missing(method, *_args)
def method_missing(method, *_args) namespace = "Selenium::DevTools::V#{Selenium::DevTools.version}" methods_to_classes = "#{namespace}::METHODS_TO_CLASSES" desired_class = if Object.const_defined?(methods_to_classes) # selenium-devtools 0.113 and newer "#{namespace}::#{Object.const_get(methods_to_classes)[method]}" else # selenium-devtools 0.112 and older "#{namespace}::#{method.capitalize}" end return unless Object.const_defined?(desired_class) self.class.class_eval do define_method(method) do Object.const_get(desired_class).new(self) end end send(method) end