```
MyList = browser.ul(:id => "PageContent_cat")
#Scrape links from the UL for visiting
MyList.links.each do |link|
puts link
puts link.text
b.goto(link)
#etc
end
#Save li items to an array for later processing
MyArray = []
MyList.lis.each do |li|
puts li.text
MyArray << li.text
#etc
end
#Iterate through your array in the same method, to report/visit/etc
MyArray.each do |item|
puts "I collected something: #{item}"
b.goto(item)
end #
```
网友评论