[Wtr-general] Click Link In Table Based on Row and Column Numbers
David Schmidt
davids at tower-mt.com
Wed Sep 6 14:31:09 EDT 2006
Be warned that this method will only work if there are no sub-tables
contained in the rows searched. This is because row_count will show the
number of rows in a single table, but ie.table[row][column] will find
every row located in OR BELOW that table.
So, if the cell at ie.table[1][1] contained a table with 2 rows then
ie.table[2][1] would be the first row of the sub-table, NOT the 2'nd row
in ie.table.
David
Attebery, Bill wrote:
> One way I can think of - not necessarily the best, based on some posts
> I've seen there seems to be the concept of cell in 1.5 that I haven't
> been able to try. But for what it's worth I think this would work.
>
> if ie.table(:index, 2).exists?
> row_count=ie.table(:index, 2).row_count
> unless row_count == nil
> for i in 1..row_count
> #assumes you're looking for data that is displayed in the
> browser as text, use a different attribute if not
> #could also use regexp ie.table(:index, 2)[i][1].text ~=
> /ColumnData/
> if (ie.table(:index, 2)[i][1].text == 'Column1Data' and
> ie.table(:index, 2)[i][2].text == 'Column2Data')
> ie.table(:index, 2)[i][3].click
> break
> end
> end
> end
> else
> puts "table not found"
> end
>
>
>> -----Original Message-----
>> From: wtr-general-bounces at rubyforge.org
>> [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of MR
>> Sent: Wednesday, September 06, 2006 9:38 AM
>> To: wtr-general at rubyforge.org
>> Subject: [Wtr-general] Click Link In Table Based on Row and
>> Column Numbers
>>
>> This is a rephrased question because i realized what i was
>> asking before didn't capture what i was trying to do.
>> Basically, I need to click on a link that may or may not
>> exist in a table. The table doesn't have an ID, but I do know
>> that it is the second table on the page. I need to indentify
>> the possible link by contents in the same row. For example, I
>> want to search the table for rows that contain 'Column1Data'
>> and 'Column2Data' in columns 1 and 2. Once I find this data,
>> I want to click on a link in the same row, but in column
>> three IF it exists. This link may not exist.
>>
>> Thanks again
>>
>>
More information about the Wtr-general
mailing list