Hello all,

I'm having difficulty programming a negative loop.  That is, while something isn't there, then do this.  Here's an example:

I've scripted Watir to randomly select a report, and then when the report comes up it checks the month of the report.  If it's not the month I want, I have the script click the "Previous" link until it finds the report I want.

Here's the code :
----
      while $ie.frame('MainWindow').span(:id, /ReportingPeriodValueLabel/).text != 'Dec 2005'
          $ie.frame('MainWindow').link(:text, 'Previous').click
      end
----

This works - most of the time.  The problem is that if the report happens to come up on particular page, the label value = 'Jan - Dec 2005' and the check above *always* fails.

I tried to change the comparison value to a regex but that didn't work.  That is, "while blahblah.text != /Dec 2005/" will be True even when the label = 'Dec 2005'! (That's no good.  I expect it to be false and break out of the loop.)

I think I'm missing something in the use of regular expressions that I just don't know yet.  (I'm just starting to learn about them - they are *way* handy.)

Paul.

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to