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