PDA

View Full Version : Retreive Cell data challenge


qaos
May 15th, 2008, 12:44 PM
I am having touble collecting specific data from a tablecell that doesn't have a name or such to identify it. The row does have an ID (in red), however, this is a list of cells and each ID is unique and would like to loop through each and collect data. Note there are other rows that are of a different format that are spaced through the list i am trying to loop through. (it would be really great if 'Cell' could be identified by 'class', alas it does not)

Here is an example of a couple rows.
I have highlighted the parts (in blue) that I would like to extract. (the <div> I can get, but that is about it)
Any help would be greatly appreciated.

<tr id="41325_307871" onClick="window.location.href='Guild.aspx?GuildID=66821&amp;Tab ID=579251&amp;ForumID=307871';" style="cursor:pointer;" class="NormGridRow" onMouseOver="DoMo(this);" onMouseOut="DoNorm(this);">
<td class="ForumIconCell" valign="Middle" align="Center" width="32px" style="width:32px;"><img src="http://www.theavantguards.com/images/forum_read.gif" alt="There are no new posts in this forum." /></td>
<td class="ForumTitleCell" valign="Top" onClick="window.location.href='Guild.aspx?GuildID=66821&amp;Tab ID=579251&amp;ForumID=307871';"><b><a href="Guild.aspx?ForumID=307871&GuildID=66821&TabID=579251">Super Group </a></b><div class="ForumDescriptionText">Members Only :: SG Related</div></td>
<td class="ForumTopicCountCell" valign="Middle" align="Center" width="40px">43</td>
<td class="ForumPostCountCell" valign="Middle" align="Center" width="40px">594</td>
<td class="ForumLastPostInfoCell" valign="Middle" align="Center" width="170px"><a style="cursor: hand;" onClick="javascript:window.open('ContentControls/Support/SendIMStandalone.aspx?ToID=539713819&GuildID=66821', 'newIM539713819', 'width=440,height=524,scrollbars=NO,resize=YES'); "><img width="12" height="9" src="GuildImages/msg_unread.gif" border="0" />&nbsp;BlueKat</a><br />5/11/2008 1:44 AM</td>
</tr>

<tr id="41327_307872" onClick="window.location.href='Guild.aspx?GuildID=66821&amp;Tab ID=579251&amp;ForumID=307872';" style="cursor:pointer;" class="AltGridRow" onMouseOver="DoMo(this);" onMouseOut="DoAlt(this);">
<td class="ForumIconCell" valign="Middle" align="Center" width="32px" style="width:32px;"><img src="http://www.theavantguards.com/images/forum_read.gif" alt="There are no new posts in this forum." /></td>
<td class="ForumTitleCell" valign="Top" onClick="window.location.href='Guild.aspx?GuildID=66821&amp;Tab ID=579251&amp;ForumID=307872';"><b><a href="Guild.aspx?ForumID=307872&GuildID=66821&TabID=579251">Bow/Officer Channel</a></b><div class="ForumDescriptionText">Officers, Please Stay Up To Date</div></td>
<td class="ForumTopicCountCell" valign="Middle" align="Center" width="40px">24</td>
<td class="ForumPostCountCell" valign="Middle" align="Center" width="40px">211</td>
<td class="ForumLastPostInfoCell" valign="Middle" align="Center" width="170px"><a style="cursor: hand;" onClick="javascript:window.open('ContentControls/Support/SendIMStandalone.aspx?ToID=538383802&GuildID=66821', 'newIM538383802', 'width=440,height=524,scrollbars=NO,resize=YES'); "><img width="12" height="9" src="GuildImages/msg_unread.gif" border="0" />&nbsp;Pulsaria</a><br />4/13/2008 7:08 PM</td>
</tr>

qaos
May 23rd, 2008, 10:29 AM
I managed to find a workaround, but still would like a better way to do this.

Workaround:
I had to basically hard code everything. Since I am navigating from page to page, I couldn't just use the table obj as the handle to it gets lost when you nav to another page. Here's a short sample of what I did. (If you would like further explanation of the cold I can post it.)

Code:

tbl = @browser.table(:index, 5)
# For each row in Table get Thread
tbl.row_count().times { |indx|
table = @browser.table(:index, 5)
r = table.[](indx + 1)
r.[](2).link(:index, 1).click
...
}