File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
rb/lib/selenium/webdriver/common Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -108,22 +108,20 @@ def run(*command)
108
108
109
109
begin
110
110
stdout , stderr , status = Open3 . capture3 ( *command )
111
- json_output = stdout . empty? ? nil : JSON . parse ( stdout )
112
- result = json_output [ 'result' ]
113
111
rescue StandardError => e
114
112
raise Error ::WebDriverError , "Unsuccessful command executed: #{ command } ; #{ e . message } "
115
113
end
116
114
117
- ( json_output &.fetch ( 'logs' ) || [ ] ) . each do |log |
115
+ json_output = stdout . empty? ? { } : JSON . parse ( stdout )
116
+ ( json_output [ 'logs' ] || [ ] ) . each do |log |
118
117
level = log [ 'level' ] . casecmp ( 'info' ) . zero? ? 'debug' : log [ 'level' ] . downcase
119
118
WebDriver . logger . send ( level , log [ 'message' ] , id : :selenium_manager )
120
119
end
121
120
122
- if status . exitstatus . positive?
123
- raise Error ::WebDriverError , "Unsuccessful command executed: #{ command } \n #{ result } #{ stderr } "
124
- end
121
+ result = json_output [ 'result' ]
122
+ return result unless status . exitstatus . positive?
125
123
126
- result
124
+ raise Error :: WebDriverError , "Unsuccessful command executed: #{ command } \n #{ result } #{ stderr } "
127
125
end
128
126
end
129
127
end # SeleniumManager
You can’t perform that action at this time.
0 commit comments