lib/appium_lib/common/patch.rb in appium_lib-9.4.10 vs lib/appium_lib/common/patch.rb in appium_lib-9.5.0
- old
+ new
@@ -60,28 +60,30 @@
# Print JSON posted to Appium. Not scoped to an Appium module.
#
# Requires from lib/selenium/webdriver/remote.rb
require 'selenium/webdriver/remote/capabilities'
-require 'selenium/webdriver/remote/w3c_capabilities'
+require 'selenium/webdriver/remote/w3c/capabilities'
require 'selenium/webdriver/remote/bridge'
-require 'selenium/webdriver/remote/w3c_bridge'
+require 'selenium/webdriver/remote/oss/bridge'
+require 'selenium/webdriver/remote/w3c/bridge'
require 'selenium/webdriver/remote/server_error'
require 'selenium/webdriver/remote/response'
-require 'selenium/webdriver/remote/commands'
-require 'selenium/webdriver/remote/w3c_commands'
+require 'selenium/webdriver/remote/oss/commands'
+require 'selenium/webdriver/remote/w3c/commands'
require 'selenium/webdriver/remote/http/common'
require 'selenium/webdriver/remote/http/default'
# @private
# Show http calls to the Selenium server.
#
# Invaluable for debugging.
def patch_webdriver_bridge
Selenium::WebDriver::Remote::Bridge.class_eval do
# Code from lib/selenium/webdriver/remote/bridge.rb
- def raw_execute(command, opts = {}, command_hash = nil)
+
+ def execute(command, opts = {}, command_hash = nil)
verb, path = commands(command) || raise(ArgumentError, "unknown command: #{command.inspect}")
path = path.dup
path[':session_id'] = @session_id if path.include?(':session_id')
@@ -128,11 +130,11 @@
Appium::Logger.ap_info command_hash
end
delay = $driver.global_webdriver_http_sleep
sleep delay if !delay.nil? && delay > 0
# Appium::Logger.info "verb: #{verb}, path #{path}, command_hash #{command_hash.to_json}"
- http.call verb, path, command_hash
+ http.call(verb, path, command_hash)
end # def
end # class
end
# Print Appium's origValue error messages.
@@ -144,10 +146,11 @@
val = value
case val
when Hash
msg = val['origValue'] || val['message'] or return 'unknown error'
+ msg << ": #{val['alert']['text'].inspect}" if val['alert'].is_a?(Hash) && val['alert']['text']
msg << " (#{val['class']})" if val['class']
when String
msg = val
else
msg = "unknown error, status=#{status}: #{val.inspect}"
@@ -161,10 +164,10 @@
remove_const :DEFAULT_HEADERS if defined? DEFAULT_HEADERS
DEFAULT_HEADERS = { 'Accept' => CONTENT_TYPE, 'User-Agent' => "appium/ruby_lib/#{::Appium::VERSION}" }.freeze
end
def patch_remote_driver_commands
- Selenium::WebDriver::Remote::Bridge.class_eval do
+ Selenium::WebDriver::Remote::OSS::Bridge.class_eval do
def commands(command)
::Appium::Driver::Commands::COMMAND[command]
end
end
end