Top Level Namespace
Defined Under Namespace
Modules: Appium, Minitest Classes: BigDecimal, FalseClass, NilClass, Numeric, Object, Symbol, TrueClass
Instance Method Summary collapse
- #patch_remote_driver_commands ⇒ Object
-
#patch_webdriver_bridge ⇒ Object
Show http calls to the Selenium server.
Instance Method Details
#patch_remote_driver_commands ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/appium_lib/common/patch.rb', line 155 def patch_remote_driver_commands Selenium::WebDriver::Remote::Bridge.class_eval do def commands(command) ::Appium::Driver::Commands::COMMAND[command] end end end |
#patch_webdriver_bridge ⇒ Object
Show http calls to the Selenium server.
Invaluable for debugging.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/appium_lib/common/patch.rb', line 69 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) verb, path = commands(command) || raise(ArgumentError, "unknown command: #{command.inspect}") path = path.dup path[':session_id'] = @session_id if path.include?(':session_id') begin opts.each do |key, value| path[key.inspect] = escaper.escape(value.to_s) end rescue IndexError raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}" end # convert /// into / path.gsub!(/\/+/, '/') # change path from session/efac972c-941a-499c-803c-d7d008749/execute # to /execute # path may be nil, session, or not have anything after the session_id. path_str = path path_str = '/' + path_str unless path_str.nil? || path_str.length <= 0 || path_str[0] == '/' path_match = path.match(/.*\h{8}-?\h{4}-?\h{4}-?\h{4}-?\h{12}/) path_str = path.sub(path_match[0], '') unless path_match.nil? Appium::Logger.info "#{verb} #{path_str}" # must check to see if command_hash is a hash. sometimes it's not. if command_hash.is_a?(Hash) && !command_hash.empty? print_command = command_hash.clone print_command.delete :args if print_command[:args] == [] if print_command[:using] == '-android uiautomator' value = print_command[:value].split(';').map { |v| "#{v};" } print_command[:value] = value.length == 1 ? value[0] : value # avoid backslash escape quotes in strings. "\"a\"" => "a" Appium::Logger.info print_command.ai.gsub('\"', '"') else Appium::Logger.ap_info print_command end elsif command_hash # non-standard command hash # It's important to output this for debugging problems. # for example invalid JSON will not be a Hash 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 end # def end # class end |