Forum: Ruby How to Read Text from Webipage when its disabled

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
18709079a981155a1990f0748eb40bdd?d=identicon&s=25 Rase In (rasein)
on 2009-05-13 17:25
the webpage i m testing has many list box, text box, radio butons etc...
and it has Text field which is in Diabled and its not Text box;
eg:once after registering in website, the name field bcomes disabled and
its in Table format...

find the attached screen and element source Base Premimum...how to read
the datas and store it in exce,csv or anything

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Strict//EN"><META
http-equiv="Content-Type" content="text/html; charset=utf-8"> <HTML
xmlns="http://www.w3.org/1999/xhtml"><BODY><TABLE
class="width100"><TBODY><TR><TD class="noSurround"><TABLE
class="size100"><TBODY><TR><TD class="valignTop size100
noSurround"><TABLE class="size100"><TBODY><TR class="height100"><TD
class="valignTop"><FORM id="policyForm" name="policyForm"
action="/nw/policy/details/premium.xhtml" method="post" target=""><TABLE
class="data" style="WIDTH: 100%; BACKGROUND-COLOR: #c2c5ca"
cellSpacing="0" cellPadding="0" border="0"><TBODY><TR><TD><TABLE
class="table_style" cellSpacing="0" cellPadding="1"><TBODY
id="policyForm:_id69:tbody_element"><TR class="oddRow"> <TD
class="cell_align_right">$3,498.36</TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
134ea397777886d6f0aa992672a50eaa?d=identicon&s=25 Mark Thomas (Guest)
on 2009-05-13 18:25
(Received via mailing list)
On May 13, 11:25 am, Rase In <mohamedra...@gmail.com> wrote:
> the webpage i m testing has many list box, text box, radio butons etc...
> and it has Text field which is in Diabled and its not Text box;
> eg:once after registering in website, the name field bcomes disabled and
> its in Table format...

A table is not the same thing as a disabled input control. However, it
doesn't really matter when all you want to do is extract the data.

> find the attached screen and element source Base Premimum...how to read
> the datas and store it in exce,csv or anything

You read the data the same way you'd read any HTML data, with an HTML
parser. First, you determine how to uniquely and consistently identify
the data you want to extract. Second, you construct an expression to
extract it.

I will provide an example using Nokogiri. Let's assume that you want
the dollar value that is always in the TD under the TBODY that has and
id of "policyForm:_id69:tbody_element". Here's what you can do:

doc = Nokogiri::HTML(html)
puts doc.search('//tbody[@id="policyForm:_id69:tbody_element"]/tr/
td').inner_html

-- Mark.
This topic is locked and can not be replied to.