# List links in a DIV using watir module

**URL:** <https://www.ruby-forum.com/t/list-links-in-a-div-using-watir-module/116635>\
**Category:** Ruby\
**Created:** [October 8, 2007, 10:15am UTC](https://www.ruby-forum.com/t/list-links-in-a-div-using-watir-module/116635 "2007-10-08T10:15:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sean\_n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sean\_n](https://www.ruby-forum.com/u/sean_n)\
**Post date:** [October 8, 2007, 10:15am UTC](https://www.ruby-forum.com/t/list-links-in-a-div-using-watir-module/116635/1 "2007-10-08T10:15:42Z")

</div>

Using the watir module, is there a way to show all the hyperlinks in a  
DIV?  
Can you please provide some code snippets?

---

<div class="post-metadata">

**Author:** ![sean\_n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sean\_n](https://www.ruby-forum.com/u/sean_n)\
**Post date:** [October 8, 2007, 11:26am UTC](https://www.ruby-forum.com/t/list-links-in-a-div-using-watir-module/116635/2 "2007-10-08T11:26:49Z")

</div>

sean\_n wrote:

> Using the watir module, is there a way to show all the hyperlinks in a  
> DIV?  
> Can you please provide some code snippets?

How about:

div\_links = ie.div(:id, “some\_id”).links  
div\_links.each { |l| puts l.to\_s }

---

<div class="post-metadata">

**Author:** ![sean\_n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sean\_n](https://www.ruby-forum.com/u/sean_n)\
**Post date:** [May 5, 2008, 8:53pm UTC](https://www.ruby-forum.com/t/list-links-in-a-div-using-watir-module/116635/3 "2008-05-05T20:53:52Z")

</div>

7stud – wrote:

> sean\_n wrote:
> 
> > Using the watir module, is there a way to show all the hyperlinks in a  
> > DIV?  
> > Can you please provide some code snippets?
> 
> How about:
> 
> div\_links = ie.div(:id, “some\_id”).links  
> div\_links.each { |l| puts l.to\_s }

This is really perfect to identify Divs.Works for me…

But how to click on each div (identified by DIV id )one at a time ?

My requirement is to click on each link & identify the output , compare  
results & then move on to next div … n so on …

Please help.
