I guess this will work: @mytestvalue = $ie.span(:id, 'db_data').text.match(/db_[0-9]*/).to_s
On Dec 16, 12:07 pm, "Paul Rogers" <paul.rog...@shaw.ca> wrote: > what does > $ie.span(:id, 'db_data').text > > return - it might be a problem with your regular expression. > What are you expecting > @mytestvalue = $ie.span(:id, 'db_data').text.matches(/"db_\\[0-9\\]*/) > > to return ( ie what are you hoping to get back ). he to_s on the end > iis unlikely to be needed > > Paul > > On Tue, Dec 16, 2008 at 11:02 AM, maven999 <maven...@gmail.com> wrote: > > > Hi Paul, > > > Thanks for your quick reply. > > > It doesn't work. And neither does it work when I convert the result > > into string: > > > @mytestvalue = $ie.span(:id, 'db_data').text.matches(/"db_\\[0-9\\] > > */) .to_s > > > I think the problem is the datastructure that the $ie.span(:id, > > 'db_data') returns. If it is an array, maybe I should be parsing it a > > different way? > > > On Dec 16, 12:48 pm, "Paul Rogers" <paul.rog...@shaw.ca> wrote: > >> you need to match on the text of the span, not the span itself. > > >> > @mytestvalue = $ie.span(:id, 'db_data').text.matches(/"db_\\[0-9\\]*/) > > >> ( i think its the .text method you want, if it gives an undefinedied > >> method error, I got it wrong ;-) ) > > >> On Tue, Dec 16, 2008 at 10:28 AM, maven999 <maven...@gmail.com> wrote: > > >> > Hi all, > > >> > I'm trying to grab a string from a block of span text from my UI. The > >> > block has <SPAN id=db_data> and the block is > > >> > Connected to: Current Database (db_1229419050) > >> > Created: Tue, 16 Dec 2008 09:17:30 GMT > >> > Next creation: Tue, 16 Dec 2008 15:17:30 GMT > > >> > I want to grab the db_* string so I can compare it to the value > >> > returned by dbi. I have tried: > > >> > @mytestvalue = $ie.span(:id, 'db_data').matches(/"db_\\[0-9\\]*/) > > >> > but I get the following error on console: > > >> > NoMethodError: undefined method `matches' for #<Watir::Span:0x3790ab0> > > >> > Does SPAN not support 'matches'? Any idea how I can get this to work? > >> > 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 -~----------~----~----~----~------~----~------~--~---