lib/appium_lib/android/helper.rb in appium_lib-0.3.9 vs lib/appium_lib/android/helper.rb in appium_lib-0.3.10
- old
+ new
@@ -72,10 +72,11 @@
obj.merge!( { id: node['name'] } ) if keys.include?('name') && !node['name'].empty?
obj.merge!( { text: node['value'] } ) if keys.include?('value') && !node['value'].empty?
# label is name
obj.merge!( { name: node['label'] } ) if keys.include?('label') && !node['label'].empty?
obj.merge!( { class: node['type'] } ) if keys.include?('type') && !obj.empty?
+ obj.merge!( { shown: node['shown'] } ) if keys.include?('shown')
r.push obj if !obj.empty?
run_internal.call node['children'] if keys.include?('children')
end
@@ -89,11 +90,11 @@
out = ''
results.each { |e|
no_text = e[:text].nil?
no_name = e[:name].nil? || e[:name] == 'null'
-
+ next unless e[:shown] # skip invisible
# Ignore elements with id only.
next if no_text && no_name
out += e[:class].split('.').last + "\n"
@@ -107,9 +108,10 @@
# find_element(:link_text, 'text')
out += " text: #{e[:text]}\n" unless no_text
# label is name. default is 'null'
# find_element(:link_text, 'Facebook')
out += " name: #{e[:name]}\n" unless no_name
+ # out += " visible: #{e[:shown]}\n" unless e[:shown].nil?
}
out
end
# Android only.
\ No newline at end of file