Please can i get some help for ruby array to get all text ............. Please find the attachment
# For example:
ary = @browser.p(class:"sv ng-binding ng-scope")
ary = Array.new
p ary.length
ary.each do |myRole|
puts "User role: #{myRole.text}"
end
# but its not working
The
p
method returns the first matchingp
element. To create a collection, you need to pluralize the method name - ieps
.ps
will return an enumerable object (ie like an Array), where each element is a Watir element.If you are trying to collect the text from each element, it can simply be: