Skip to content

Commit 61e92f8

Browse files
Add get_page_class
1 parent cca5db4 commit 61e92f8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/appium_lib/android/helper.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ def run node
275275
out
276276
end
277277

278-
# Count all classes on screen and print to stdout.
279-
# Useful for appium_console.
280-
def page_class
278+
def get_page_class
281279
r = []
282280
run_internal = lambda do |node|
283281
if node.kind_of? Array
@@ -294,11 +292,18 @@ def page_class
294292
json = get_source
295293
run_internal.call json['hierarchy']
296294

295+
res = ''
297296
r = r.sort
298297
r.uniq.each do |ele|
299-
print r.count(ele)
300-
puts "x #{ele}\n"
298+
res += "#{r.count(ele)}x #{ele}\n"
301299
end
300+
res
301+
end
302+
303+
# Count all classes on screen and print to stdout.
304+
# Useful for appium_console.
305+
def page_class
306+
puts get_page_class
302307
nil
303308
end
304309

0 commit comments

Comments
 (0)