# Pick the value from the table

**URL:** <https://www.ruby-forum.com/t/pick-the-value-from-the-table/188732>\
**Category:** Ruby\
**Created:** [May 17, 2010, 12:38pm UTC](https://www.ruby-forum.com/t/pick-the-value-from-the-table/188732 "2010-05-17T12:38:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweetzubair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sweetzubair](https://www.ruby-forum.com/u/sweetzubair)\
**Post date:** [May 17, 2010, 12:38pm UTC](https://www.ruby-forum.com/t/pick-the-value-from-the-table/188732/1 "2010-05-17T12:38:07Z")

</div>

Hello Friends,

Help me to pick value from the tables.i m confused because of the button  
name and id is same for the all button.

i attached the snap short of the table.have a look.

Commodities

```
<tr>
  <td class="vmInlineList" valign="top"><img src="images/spacer.gif"

```

width=“10” height=“10”\>

  
  
  

```
<tr>
  <td class="vmInlineList" valign="top"><img src="images/spacer.gif"

```

width=“10” height=“10”\>

  
  
  

| ![]() | | ![]() | 000000- test1 |
| | ![]() | 000002- test2 | | ![]() | 000003- test3 |

---

<div class="post-metadata">

**Author:** ![sweetzubair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sweetzubair](https://www.ruby-forum.com/u/sweetzubair)\
**Post date:** [May 17, 2010, 12:45pm UTC](https://www.ruby-forum.com/t/pick-the-value-from-the-table/188732/2 "2010-05-17T12:45:35Z")

</div>

KingMaker KingMaker wrote:

> Help me to pick value from the tables.i m confused because of the button  
> name and id is same for the all button.

What are you using to parse the web page: Nokogiri? Mechanize? Hpricot?

Using one of these, you should be able to use CSS or XPATH selectors to  
select the nth row, and/or iterate over all the rows of the table so you  
can process each one in turn.

---

<div class="post-metadata">

**Author:** ![sweetzubair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sweetzubair](https://www.ruby-forum.com/u/sweetzubair)\
**Post date:** [May 17, 2010, 2:07pm UTC](https://www.ruby-forum.com/t/pick-the-value-from-the-table/188732/3 "2010-05-17T14:07:13Z")

</div>

I dont know because i m new in ruby.  
dont know how to get value from html table.

---

<div class="post-metadata">

**Author:** ![sweetzubair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sweetzubair](https://www.ruby-forum.com/u/sweetzubair)\
**Post date:** [May 17, 2010, 2:40pm UTC](https://www.ruby-forum.com/t/pick-the-value-from-the-table/188732/4 "2010-05-17T14:40:46Z")

</div>

On Mon, May 17, 2010 at 8:07 AM, KingMaker KingMaker  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I dont know because i m new in ruby.  
> dont know how to get value from html table.

For those of us who know Ruby, it’s very difficult to decipher what  
you are actually trying to do.

What do you mean pick “the value”. Which value?

In what context are you doing this? Brian’s answer was, I think, based  
on the assumption that you are somehow trying to parse this xml/xhtml  
in Ruby, and he suggested looking at one of the several xml parsing  
libraries for Ruby, the most popular being nokogiri.

On the other hand maybe you’re trying to ‘pick’ the right button to  
push for some kind of automated testing, using say webrat.

In any case I suspect that this is more of a css/xpath selector  
question than a Ruby question, but from the little you’ve told us so  
far it’s hard, if not impossible to tell.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Github: [rubyredrick (Rick DeNatale) · GitHub](http://github.com/rubyredrick)  
Twitter: @RickDeNatale  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)
