Forum: Ruby question from WATIR

5dfc843f9ecf6fb64b52a35bdce43910?d=identicon&s=25 Raja gopalan (arc)
on 2014-02-21 12:32
hi,

please look at the code below

$browser.table(:id,'something').rows.each do |row|
   $browser.button(:id,'Next').click  #it will bring to next page
   $browser.button(:id,'Back').click  #again bring to the first page
   row.click
end

my problem is this 'row.click' is not working here since I moved to next
page and coming back the same page. How would I resolve this problem?

RAJ
920f6e4a0fbf997d851455f827a10ebc?d=identicon&s=25 unknown (Guest)
on 2014-02-21 12:54
(Received via mailing list)
It's hard to tell without knowing why it's not working. What error
message
did you get?
Also, we need to know what web pages you're testing against, either the
url or the source code.
Without those I'm guessing you have to wait for the page to fully load
before you can click the element.




"ruby-talk" <ruby-talk-bounces@ruby-lang.org> wrote on 02/21/2014
06:32:39
AM:
5dfc843f9ecf6fb64b52a35bdce43910?d=identicon&s=25 Raja gopalan (arc)
on 2014-02-21 13:31
but can you please tell me when we are inside the b.table.rows.each
loop, Can we move to another screen, and come back to same page and then
can we able to use the variable 'row.click' And I will post my error
also,

unknown property or method `click'
    HRESULT error code:0x80070005

And I am sure this error occur because I moved to another screen and
then I came back.

RAJ
920f6e4a0fbf997d851455f827a10ebc?d=identicon&s=25 unknown (Guest)
on 2014-02-21 14:00
(Received via mailing list)
I haven't tried it, and I mainly use watir-webdriver & selenium.
However, I would expect it to work. The 'row' object should still be
correct.

The error does not look like its having a problem finding the row. I
would
expect an error like 'unable to locate . . .' or ' unknown method....
for
nil' if the row couldn't be found or if 'row' had been reset. It looks
like 'row' is an object that doesn't have a click method even if it
found
the row on the page.

Does it work if the 'next' & 'back' lines are commented out?





"ruby-talk" <ruby-talk-bounces@ruby-lang.org> wrote on 02/21/2014
07:31:55
AM:

> From: Raja gopalan <lists@ruby-forum.com>
> To: ruby-talk@ruby-lang.org
> Date: 02/21/2014 07:32 AM
> Subject: Re: question from WATIR
> Sent by: "ruby-talk" <ruby-talk-bounces@ruby-lang.org>
>
> but can you please tell me when we are inside the b.table.rows.each
> loop, Can we move to another screen, and come back to same page and then
5dfc843f9ecf6fb64b52a35bdce43910?d=identicon&s=25 Raja gopalan (arc)
on 2014-02-21 14:04
unknown wrote in post #1137470:
> Does it work if the 'next' & 'back' lines are commented out?

yes yes, It's working.  Even I was also expecting the same error like

undefined method `click' for nil:NilClass (NoMethodError) But it was
not, row is available there, because I printed the class of row like
"puts row.class", it's printing the class: Watir::TableRow.

RAJ.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.