[wtr-general] Re: div values in table

2010-02-09 Thread tester86
Hi

The value 601 is stored in total and I want to make sure that 'total'
matches the value on the screen (overall total). Is there any way that
I can compare to make sure that is it the correct total.

if total 601
and
overall total is 601

passed.

I tried to do if $b.contains_text(total) but it fails.



On Feb 8, 3:02 pm, orde ohil...@gmail.com wrote:
 The .html method is returning a string value.   So, you're adding
 14.56 and 85.00 to create 14.5685.00

 You need to convert the a and b variables to a numeric class.  In this
 case, you want to use .to_f:

 total = a.to_f +  b.to_f

 Hope that helps.

 orde

 On Feb 8, 12:45 pm, tester86 sagar.am...@gmail.com wrote:



  Sorry but in IRB when I do

  a= $b.table(:index, 1)[2][11].html
  print 14.56

  b=$b.table(:index, 1)[2][11].html
  print 85.00

  total = a +  b

  in IRB it returns 14.5685.00

  when it should return 99.56

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Re: div values in table

2010-02-09 Thread orde
browser.contains_text(total) is matching against the string
total.

If you looking check the value of the variable named total, then you
would do this: browser.contains_text(#{total}).

Also, the .contains_text method has been deprecated in favor
of .text.include?  See 
http://wtr.rubyforge.org/rdoc/1.6.5/classes/Watir/PageContainer.html#M000192

orde

On Feb 9, 12:14 pm, tester86 sagar.am...@gmail.com wrote:
 Hi

 The value 601 is stored in total and I want to make sure that 'total'
 matches the value on the screen (overall total). Is there any way that
 I can compare to make sure that is it the correct total.

 if total 601
 and
 overall total is 601

 passed.

 I tried to do if $b.contains_text(total) but it fails.

 On Feb 8, 3:02 pm, orde ohil...@gmail.com wrote:



  The .html method is returning a string value.   So, you're adding
  14.56 and 85.00 to create 14.5685.00

  You need to convert the a and b variables to a numeric class.  In this
  case, you want to use .to_f:

  total = a.to_f +  b.to_f

  Hope that helps.

  orde

  On Feb 8, 12:45 pm, tester86 sagar.am...@gmail.com wrote:

   Sorry but in IRB when I do

   a= $b.table(:index, 1)[2][11].html
   print 14.56

   b=$b.table(:index, 1)[2][11].html
   print 85.00

   total = a +  b

   in IRB it returns 14.5685.00

   when it should return 99.56

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Re: div values in table

2010-02-08 Thread tester86
Please disregard this post...I have got it working.

Thanks

On Feb 8, 2:33 pm, tester86 sagar.am...@gmail.com wrote:
 hi

 I am printing out the value in a column in irb and then I want to
 store that value in a variable and  calculate the two values. If I do

 $b.table(:index, 1)[2][11].html
 print $90

 $b.table(:index, 1)[3][11].html
 print $80

 Then if I do:

 def test_total(a,y)

 a= $b.table(:index, 1)[2][11].html
 y=$b.table(:index, 1)[3][11].html

 total = a + y

 return total

 end

 In IRB it returns Nil

 Does anyone have any ideas on why this is not working and returning
 nil. If not can someone point me in the correct direction.

 Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Re: div values in table

2010-02-08 Thread tester86
Sorry but in IRB when I do

a= $b.table(:index, 1)[2][11].html
print 14.56

b=$b.table(:index, 1)[2][11].html
print 85.00

total = a +  b

in IRB it returns 14.5685.00

when it should return 99.56

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Re: div values in table

2010-02-08 Thread tester86
please diregard this post I have found the solution.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Re: div values in table

2010-02-08 Thread orde
The .html method is returning a string value.   So, you're adding
14.56 and 85.00 to create 14.5685.00

You need to convert the a and b variables to a numeric class.  In this
case, you want to use .to_f:

total = a.to_f +  b.to_f

Hope that helps.

orde

On Feb 8, 12:45 pm, tester86 sagar.am...@gmail.com wrote:
 Sorry but in IRB when I do

 a= $b.table(:index, 1)[2][11].html
 print 14.56

 b=$b.table(:index, 1)[2][11].html
 print 85.00

 total = a +  b

 in IRB it returns 14.5685.00

 when it should return 99.56

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


[wtr-general] Re: div values in table

2010-02-08 Thread tester86
Yep, I was using to_i but it was rounding up the numbers. I will try
to_f.

Thanks orde

On Feb 8, 3:02 pm, orde ohil...@gmail.com wrote:
 The .html method is returning a string value.   So, you're adding
 14.56 and 85.00 to create 14.5685.00

 You need to convert the a and b variables to a numeric class.  In this
 case, you want to use .to_f:

 total = a.to_f +  b.to_f

 Hope that helps.

 orde

 On Feb 8, 12:45 pm, tester86 sagar.am...@gmail.com wrote:



  Sorry but in IRB when I do

  a= $b.table(:index, 1)[2][11].html
  print 14.56

  b=$b.table(:index, 1)[2][11].html
  print 85.00

  total = a +  b

  in IRB it returns 14.5685.00

  when it should return 99.56

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general