Sorry, I didn't see the previous message before I posted the above reply. Ravi, it worked! Thanks...so looks like my regexp was wrong all along.
Thanks Paul for pointing me to text. Watir forum ROCKS! On Dec 16, 1:16 pm, maven999 <maven...@gmail.com> wrote: > The problem is that db_data is the id for 2 lines of data. The > 'db_1229419050' string itself does not have an exclusive id. > > When I drill down to the string using IE toolbar, I see the following > structure: > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Strict//EN"><META http- > equiv="Content-Type" content="text/html; charset=windows-1252"> <HTML > class="dj_ie dj_ie7"><BODY class="tundra"><DIV id="db_top" > style="PADDING-RIGHT: 10px; FLOAT: right; TEXT-ALIGN: right"><SPAN > id="db_data"> (idb_1229440654) </SPAN></DIV></BODY></HTML> > > But clicking on the db_data text in IE toolbar highlights 2 whole > lines in UI, instead of JUST 'idb_1229440654'. > > Does that make sense? > > On Dec 16, 1: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 -~----------~----~----~----~------~----~------~--~---