Skip to content

Commit 460699c

Browse files
Update current_app
1 parent b707063 commit 460699c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/appium_lib/common/helper.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ def tag tag_name
220220
# Lists package, activity, and adb shell am start -n value for current app.
221221
# Works on local host only (not remote).
222222
def current_app
223-
line = `adb shell dumpsys window windows`.each_line.grep(/mFocusedApp/).first
224-
puts line
223+
line = `adb shell dumpsys window windows`.each_line.grep(/mFocusedApp/).first.strip
225224
pair = line.split(' ').last.gsub('}','').split('/')
226-
{ package: pair.first, activity: pair.last, am_start: pair.first + '/' + pair.last }
225+
OpenStruct.new line: line,
226+
package: pair.first,
227+
activity: pair.last,
228+
am_start: pair.first + '/' + pair.last
227229
end
228230
end # module Appium::Common

0 commit comments

Comments
 (0)