Anna, I had something similar as you describe—in my case dynamically add/removed buttons on a page inside a table.  When add/removing I had to reload the table object before WATIR could see and respond to the newly added/removed object. My code was something like this:

 

            #navigate to the page to test

gotoPopUpPage()

            $ie.link(:text, /Functional Area/i).click

           

            #load the table before removing any rows

            table = $ie.table(:index, 8)

           

            #get the number of rows 

            rowCount = table.row_count

           

            #remove a row from the table 

            table[rowCount][2].button("Delete").click

           

            #reload table to account for removal of row

            table = $ie.table(:index, 8)

 

begin

            #compare row count before and after

                        assert_not_equal(rowCount,table.row_count)

            rescue => e

                        puts "*FAILED*." + e.message + "\n" + e.backtrace.join("\n")

            end

            $ie.close

 

You might try reloading your MyTable object before you try clicking the dynamically added objects.

 

Hope this helps.

 

--Mark


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anna Tuisheva
Sent: Friday, September 16, 2005 6:00 PM
To: [email protected]
Subject: Re: [Wtr-general] Clicking a tablecell does fire up an event

 

Thanks for your reply, John.

 

I used AutoIt to click by coordinates  - MouseClick("left", x, y).

When I fire one of the events (MyTable[1][6].fireEvent("ondblclick")), I get script error that complains about no cells being selected.

Is there a way to select table cell?

Or may be a way to assign a value to the cell's custom properties? The cells have cellValue attribute, and may be I can assign a value to this attribute directly?

 

Anna.

 

On 9/16/05, John Lloyd-Jones <[EMAIL PROTECTED]> wrote:

Anna
Difficult to say without seeing the event handler code, but I would guess that the event handler is using some information from the event that you are not supplying in your fireEvent call. When you say it seems to work "clicking cells by coordinates", how did you pass those values? In the event object?
John

On 9/16/05, Anna Tuisheva < [EMAIL PROTECTED]> wrote:

I'm working with a page that has a table with two events - onKeyDown and onDblClick. When these events occur, an input text box is displayed in a cell that's been clicked. It's always the same input, but repositioned to a new cell each time. It is not visible when no cells are active: it is located on an invisible layer. All these objects are in a frame.

Luckily, all table cells have IDs. Watir clicks and sets focus to the cells, but the events are never fired up. No errors returned; the cells are highlighted as they are clicked, so this part works.

I need to enter values into the cells using the input that is displayed after clicking them (this is a table event). I tried Table[1][1].click, Table[1].[1].focus, Table.fireEvent, Table[1][1].fireEvent, send_keys, and several AutoIt tricks. I also tried various combinations of all these methods. The only thing that seems to work is clicking cells by coordinates. This is not an option at all.

Any ideas?

 

Thanks,

Anna.


_______________________________________________
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

 

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to