[Wtr-general] How to get value from textfield of the webpage using Watir/Ruby?

Anil Kumar Das anil.kumar.das at gmail.com
Mon Apr 24 10:53:48 EDT 2006


I want to compare value of textfield appeared on webpage with expected
output.



for example:

I have three fields with populated value..



Customer Name:

Customer Address:

LOC No



html code:



<input type="text" size="15" maxlength="50" name="cust_name"  value="TATA
IRON AND STEEL COMANY" tabIndex=1>

<input type="text" size="15" maxlength="50" name="cust_addr"  value="H-12
Drive, Jamshedpur" tabIndex=1>

<input type="text" size="15" maxlength="50" name="loc_no"  value="TIB_HX_0045"
tabIndex=1>





I need to get values and compare:



Get field value in a variable, compare with expected value and show the
result..

@a= cust_name

if a= 'TATA IRON AND STEEL COMPANY"

puts 'customer name is correct'

else

puts 'customer name is incorrect'





I will highly appreciate if someone could give me idea/syntax or suggest the
workaround..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060424/6bd6a05f/attachment.html 


More information about the Wtr-general mailing list