I think using XPath extension will be able to address this issue in a more simpler way than iterating over all the tables. Please refer to:
http://rubyforge.org/pipermail/wtr-general/2005-August/003182.html
You can download the latest tar ball from HEAD to use this extension. There is also a help document in the doc section.
Regards,
Angrez
On 2/24/06, Neri, Marco <[EMAIL PROTECTED]> wrote:
FYI. Solution to my problem in case anyone else has a similar problem
Using wet.
Iterate over all the tables in the page. Find the index of the table
that matches the desired text. Use the index to access the table.
for i in 1..ie.tables.length # count of all tables in the page
index = "index:=".concat(i.to_s)
text = Browser("title:=MyPage").Table(index.to_s).text
md = /^Names \([0-9]+\)$/.match(text)
if (md != nil)
break
end
end
Browser("title:=MyPage").Table(index).fire_event("onClick")
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Neri, Marco
Sent: Monday, 20 February 2006 12:29
To: [email protected]
Subject: [Wtr-general] (nested?) table access - need help.
Hi
The developers on the application I'm testing have replaced a (menu)
table of url links with rad panel control ( a 3rd party js control from
telerik ).
Using table = @ie.table(:index , i) in a loop, in the console I can see
tabletype:
id: PersonLinks_collapsableLinks
name:
value:
disabled: false
rows: 34
cols: 1
Using
row = @ie.table(:id , 'PersonLinks_collapsableLinks')[3]
puts(row[1].to_s)
In the console I see ( )
Names (6)
Addresses (15)
Phone Numbers (6)
Photos (21)
Physical Descriptions (4)
Scars, Marks, Tattoos (10)
Miscellaneous IDs (1)
Contacts (1)
Dossier
Known Associates (0)
Criminal History
Does this suggest that the one cell contains all of the items listed
above ?
What I was wanting to be able to do was access individual cell and then
use .fire_Event("onClick") on it to trigger the menu items. I managed to
get this to work for the 1st level of the menu ( details ).
table = @ie.table(:id , 'PersonLinks_collapsableLinks')
table[3][0].flash
table[3][0].fire_event("onClick")
The control then expands out the 2nd level of the menu with all of the
items listed above.
By counting the <tr> in the src for the table I can see why the 34 rows.
This must also count up the nested tables?
How can I access the nested table in order to access the row/cell within
that? I can't use id as that tag hasn't been defined for the nested
table ?
thanks
Src for the table is :
</script><span id="PersonLinks_collapsableLinksStyleSheetHolder"
style="display:none"></span><script
type="text/_javascript_">RadPanelbarAppendStyleSheet('PersonLinks_collapsa
bleLinks', '/LEAP/Web/UI/Style/panelbar.css');</script><table
id="PersonLinks_collapsableLinks" cellspacing="0" cellpadding="0"
class="Panelbar" style="width:100%;visibility: hidden">
<tr>
<td id="SUMMARY"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="HeaderSelected" style="width:100%;">
<tr>
<td id="SUMMARY_Text"
style="width:100%;">Summary</td>
</tr>
</table></td>
</tr><tr>
<td id="DETAILS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="HeaderCollapsed" style="width:100%;">
<tr>
<td id="DETAILS_Text"
style="width:100%;">Details</td>
</tr>
</table></td>
</tr><tr style="display: none"><td valign="top"
id="DETAILS_Panel" style="white-space: nowrap; width: 100%; display:
none"><table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td id="NAMES"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="NAMES_Text"
style="width:100%;">Names (6)</td>
</tr>
</table></td>
</tr><tr>
<td id="ADDRESSES"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="ADDRESSES_Text"
style="width:100%;">Addresses (15)</td>
</tr>
</table></td>
</tr><tr>
<td id="PHONES"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="PHONES_Text"
style="width:100%;">Phone Numbers (6)</td>
</tr>
</table></td>
</tr><tr>
<td id="IMAGES"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="IMAGES_Text"
style="width:100%;">Photos (21)</td>
</tr>
</table></td>
</tr><tr>
<td id="DESCRIPTIONS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="DESCRIPTIONS_Text"
style="width:100%;">Physical Descriptions (4)</td>
</tr>
</table></td>
</tr><tr>
<td id="TATTOOS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="TATTOOS_Text"
style="width:100%;">Scars, Marks, Tattoos (10)</td>
</tr>
</table></td>
</tr><tr>
<td id="MISCELLANEOUSIDS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="MISCELLANEOUSIDS_Text"
style="width:100%;">Miscellaneous IDs (1)</td>
</tr>
</table></td>
</tr><tr>
<td id="CONTACTS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="CONTACTS_Text"
style="width:100%;">Contacts (1)</td>
</tr>
</table></td>
</tr><tr>
<td id="DOSSIER"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="DOSSIER_Text"
style="width:100%;">Dossier</td>
</tr>
</table></td>
</tr><tr>
<td id="KNOWNASSOCIATES"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="KNOWNASSOCIATES_Text"
style="width:100%;">Known Associates (0)</td>
</tr>
</table></td>
</tr><tr>
<td id="CRIMINALHISTORY"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="CRIMINALHISTORY_Text"
style="width:100%;">Criminal History</td>
</tr>
</table></td>
</tr>
</table></td></tr><tr>
<td id="INVOLVEMENTS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="HeaderCollapsed" style="width:100%;">
<tr>
<td id="INVOLVEMENTS_Text"
style="width:100%;">Involvements</td>
</tr>
</table></td>
</tr><tr style="display: none"><td valign="top"
id="INVOLVEMENTS_Panel" style="white-space: nowrap; width: 100%;
display: none"><table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td id="INTERESTFLAGS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="INTERESTFLAGS_Text"
style="width:100%;">Interest Flags (8)</td>
</tr>
</table></td>
</tr><tr>
<td id="NAMEWHEREABOUTS"
style="white-space:nowrap;width:100%;"><table cellspacing="0"
cellpadding="0" class="ItemCollapsed" style="width:100%;">
<tr>
<td id="NAMEWHEREABOUTS_Text"
style="width:100%;">Whereabouts (2)</td>
</tr>
</table></td>
</tr>
</table></td></tr>
</table>
=======================================================
The information contained in this email and any files attached may be
confidential information to the intended recipient and may be the
subject of legal professional privilege or public interest immunity.
If you are not the intended recipient, any use, disclosure or copying is
unauthorised.
If you have received this document in error please telephone 1300 307
082
*******************************************************************
This footnote also confirms that this email message has been swept for
the presence of computer viruses.
*******************************************************************
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
=======================================================
The information contained in this email and any files attached may
be confidential information to the intended recipient and may be
the subject of legal professional privilege or public interest immunity.
If you are not the intended recipient, any use, disclosure or copying is
unauthorised.
If you have received this document in error please telephone 1300 307 082
*******************************************************************
This footnote also confirms that this email message has been swept
for the presence of computer viruses.
*******************************************************************
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
