This will print out the phone number in the cell: puts @browser.cell(:xpath, "//i...@src='../images/ icon_telephone.gif']/../").text
Note: just change @browser to the name of the browser object that you're using. Hope that helps... On Mar 27, 12:53 pm, "Dennis I." <ideler.den...@gmail.com> wrote: > I'm trying to display some text which is in a row. > > Here is a simplified version of the HTML code (I removed all > irrelevant table rows): > > <table id="tbl_results" class="results" cellspacing="0" > cellpadding="0" border="0"> > <tbody> > <tr> > <td> > <ul> > <li> > <img class="phone_num" height="9" width="14" alt="telephone > icon" src="../images/icon_telephone.gif"/> > (902)420-3567 > </li> > <li class="whitespace">.</li> > </ul> > </td> > </tr> > </tbody> > </table> > > Now I'll explain a little... > The results have an unordered list ( under the <ul> tag) that > contains: [1] Phone number and [2] Fax number. But only if they exist. > In this example, the result contains a phone number, but not a fax > number (the fax number is specified as whitespace). > > What I'm after is to check if these results have a phone number OR a > fax number. > Now all this info wasn't really necessary, but just to make it more > clear to everyone. > > So here is my problem, how can I check that? > > I tried using element_by_xpath(xpath).text but it gave me an > error: > Exception: undefined method `text' for nil:NilClass > > I basically just want to check if that row has a phone or fax number. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---