Thanks again for replying Anthony H., I was able to get the indexes for the tables and retrieve the data by using '.text' which seems to pull more information than I need. I have been a long time QTP scriptor and they have a method called GetCellData(x,y) where you would get the number of columns and rows to pull the data. Is there a way to do that with 'watir-webdriver'?
Thank you again. Joe On Sun, Sep 9, 2012 at 9:32 PM, Anthony Hallett <[email protected]> wrote: > Hi Joe > > Is this a complete copy of your html or have you edited it down? .. I > don't think what you have posted is valid as I can't get the open & close > tags to match up > > > What I would do is indent each child tag so that I can see clearly which tag > is the direct parent of the cell I'm interested in. I started with this : > > <div id="main" style="padding: 10px"> > > <table cellspacing="0" cellpadding="0"> > > <tbody> > > <tr> > > <td align="left" style="vertical-align: top;"> > > <table cellspacing="5" cellpadding="0"> > > <tbody> > > <tr> > > <td align="left" style="vertical-align: top;"> > > <table class="gwt-DecoratorPanel" cellspacing="0" > cellpadding="0"> > > > But came to a halt here as next is an end tag </td> but the table is still > open (html is nested so this is bad) . > > If this is all the html, I'm surprised if it renders in a browser & have no > idea how to automate it. > > I there is more than you have posted try this exercise .. indent each open > tag below it's parent until you come to it's close tag. > > you should end up with something like: > > <div> > > <table> > > <tbody> > > <tr> > > <td> > > </td> > > </tr> > > </tbody> > > </table> > > </div> > > where each open tag has a close tag & they are all nested .. > > Then work backward from the cell you want to build a unique id path .. > > You may end up with something like: > > br.div(:id => "main").table(:index => 1).tr(:index => 0).td(:index => 1) > > > Cheers > > Anthony H > > > > > On Saturday, 1 September 2012 06:21:15 UTC+10, Joe Fl wrote: >> >> Hi Everyone, >> >> I am working on automating an GWT app for the first time. I am trying to >> get data from td tag in a >> specific table . >> >> When I run the following code: >> >> thr = br.div(:class,'middleCenterInner').trs >> >> I get the data from the first td. I need to get to the second. >> >> Here the code: >> >> <div id="main" style="padding: 10px"> >> <table cellspacing="0" cellpadding="0"> >> <tbody> >> <tr> >> <td align="left" style="vertical-align: top;"> >> <td align="left" style="vertical-align: top;"> ** I need to data from >> this one. >> </tr> >> </tbody> >> </table> >> </div> >> >> You can see there is nothing useful to use to get there. Most of the >> useful tags in the these >> tds are the same. >> >> I did try using the index and that didn't workout. >> My Code: >> thr = br.td(:index,1).div(:class,'middleCenterInner').trs >> >> Any help would be greatly appreciated. >> >> Thank you, >> Joe > > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
