Hi Damien!
Rows in a table typically contain elements that you click on rather
than the clicking on the row itself. I see you're firing the
javascript event, but you're not actually calling the click method on
any element. Have you tried to click on a link or span of text
first? Here's an example with your code, but you should use a dev
tool to determine the type of the element the text you want to click
on.
if cell.text =~ /BE - SO - Infrastructure Management BE/
puts t[i].text
cell.link(:text, /BE - SO - Infrastructure Management BE/).click
t[i].fire_event("OnClick")
end
Hope this helps!
-Tiffany
On Apr 29, 9:39 am, Damien <[email protected]> wrote:
> Hi,
>
> I try to automate some tasks with Watir but I have a problem with a
> functionnal scenario. How to click on a row in a table. The row is
> flashing in yellow color, but no click event
>
> I have try this without success :
>
> popup.frame("autoCompleteDialogIF").frame("availFrame").tables.each do
> |t|
> for i in 1..t.row_count
> t[i].each do |cell|
> if cell.text =~ /BE - SO - Infrastructure Management BE/
> puts t[i].text
> t[i].fire_event("OnClick")
> end
> end
> end
> end
>
> I must find a solution to send this event in order to run the
> javascript command :
> onclick=javascript:parent.MainSelectControl.selectRow()
>
> Any idea ?
>
> Here is a sample html code :
>
> <TABLE id=datatable borderColor=red cellSpacing=0 cellPadding=0
> width="100%" border=0>
> <THEAD>
> <TR>
> <TD class="ac-prompt-header ac-click-message-header"
> colSpan=2>Click a value to select</TD>
> </TR>
> <TR>
> <TD class="ac-single-col-header ac-prompt-header"
> vAlign=top
> noWrap>Resource Pool Name </TD>
> <TD class="ac-single-col-header ac-prompt-header"
> vAlign=top
> noWrap>Pool Manager </TD>
> </TR>
> <TR>
> <TD class=ac-divider-line colSpan=2> </TD>
> </TR>
> </THEAD>
> <TBODY class=ac-frame-table-area>
> <TR class=list-coldata-leftalign id="5.36.30023.AUS -
> Mainframe and
> Database Support"
> onmouseover=javascript:parent.MainSelectControl.highlightRow(this);
> onclick=javascript:parent.MainSelectControl.selectRow();
> onmouseout=javascript:parent.MainSelectControl.unHighlightRow();>
> <TD class=ac-table-cell>AUS - Mainframe and Database
> Support </
> TD>
> <TD class=ac-table-cell>Admin User </TD>
> </TR>
> <TR class=list-coldata-leftalign id="5.38.31402.BE - SO -
> Infrastructure Management BE"
> onmouseover=javascript:parent.MainSelectControl.highlightRow(this);
> onclick=javascript:parent.MainSelectControl.selectRow();
> onmouseout=javascript:parent.MainSelectControl.unHighlightRow();>
> <TD class=ac-table-cell>BE - SO - Infrastructure
> Management
> BE </TD>
> <TD class=ac-table-cell>Alain Ponsaers </TD>
> </TR>
> <TR class=list-coldata-leftalign id="5.35.31412.BE - TS -
> Front-End
> Applications BE"
> onmouseover=javascript:parent.MainSelectControl.highlightRow(this);
> onclick=javascript:parent.MainSelectControl.selectRow();
> onmouseout=javascript:parent.MainSelectControl.unHighlightRow();>
> <TD class=ac-table-cell>BE - TS - Front-End
> Applications BE </
> TD>
> <TD class=ac-table-cell>Pieter Notelaers </TD>
> </TR>
> </TBODY>
> </TABLE>
>
> --
> Before posting, please readhttp://watir.com/support. In short: search before
> you ask, be nice.
>
> You received this message because you are subscribed
> tohttp://groups.google.com/group/watir-general
> To post: [email protected]
> To unsubscribe: [email protected]
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
You received this message because you are subscribed to
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]