Is there any way to get all the links given an attribute?
Down the tree, I get a lot of these tags:
<div class="name">
<a hef="http://www.example.com/link">This is a name</a>
</div>
Is there a way to do something like this: b.links(:class, "name") and it’ll output all the hyperlinks and titles from all div name classes?
Explicitly how you’ve described the browser objects regarding attributes, this is how you’d have to do that. Otherwise, @SporkInventor’s answer is spot on for link attributes.
For every div in the browser with class that equals “name”, grab all the links and throw them into the array.
@myLinks.each {|link| puts link.href } #etc, etc