[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

FireWatir in class, link doesn't work.

Flaming Flamingo

1/23/2008 1:00:00 PM

Hi All,
In the code below I'm making a first try to make a class with
FireWatir/firefox.
Now, the problem is, the clicklink doesn't work, I do get the puts's but
with the self.link there is no action(and the link does exist)... The
startup() does work.

Can anyone help me?

class CLBrowserFF<FireWatir::Firefox


def startup()
puts "startup"
self.goto('http://websit...)
puts "end startup"
end

def clicklink(gui,window,link)
#gui, window, link come later....
puts "clicklink"
self.link(:url, /_groupid_ITEM/)
puts "end clicklink"
end

end


browser = CLBrowserFF.new
browser.startup()
#gui, window, link come later....
browser.clicklink('gui','window','link')
--
Posted via http://www.ruby-....

7 Answers

Angrez

1/24/2008 4:58:00 AM

0

Hi,

Can you provide with the error message that you are using? Also you
are passing URL as a string, but while using in the code you are using
it as regexp. Not sure but that could be a problem. Can you please
post some values/exact code that you are using?

Regards,
Angrez

On Jan 23, 6:00 pm, Flaming Flamingo <g...@degekste.com> wrote:
> Hi All,
> In the code below I'm making a first try to make a class with
> FireWatir/firefox.
> Now, the problem is, the clicklink doesn't work, I do get the puts's but
> with the self.link there is no action(and the link does exist)... The
> startup() does work.
>
> Can anyone help me?
>
> class CLBrowserFF<FireWatir::Firefox
>
> def startup()
> puts "startup"
> self.goto('http://websit...)
> puts "end startup"
> end
>
> def clicklink(gui,window,link)
> #gui, window, link come later....
> puts "clicklink"
> self.link(:url, /_groupid_ITEM/)
> puts "end clicklink"
> end
>
> end
>
> browser = CLBrowserFF.new
> browser.startup()
> #gui, window, link come later....
> browser.clicklink('gui','window','link')
> --
> Posted viahttp://www.ruby-....

Flaming Flamingo

1/24/2008 7:09:00 AM

0

Hi, thanks for replying.

There is no error message, the self.link(..) code is ignored totally.
I also tried to enter the complete url and not the regexp. but there is
no difference.
The string passed to the def isn't used (at this moment).
The posted code is the code I use (except for the http://w...).
(and there is a " require 'firewatir'" on top of the code)

cheers.



Angrez wrote:
> Hi,
>
> Can you provide with the error message that you are using? Also you
> are passing URL as a string, but while using in the code you are using
> it as regexp. Not sure but that could be a problem. Can you please
> post some values/exact code that you are using?
>
> Regards,
> Angrez

--
Posted via http://www.ruby-....

Angrez

1/24/2008 9:12:00 AM

0

Hi,

Your code for function is like this:
> def clicklink(gui,window,link)
> #gui, window, link come later....
> puts "clicklink"
> self.link(:url, /_groupid_ITEM/)
> puts "end clicklink"
> end

But you are not using variable link anywhere? what is use of /
_groupid_ITEM/? I think I am missing something obvious over here.

- Angrez

On Jan 24, 12:08 pm, Flaming Flamingo <g...@degekste.com> wrote:
> Hi, thanks for replying.
>
> There is no error message, the self.link(..) code is ignored totally.
> I also tried to enter the complete url and not the regexp. but there is
> no difference.
> The string passed to the def isn't used (at this moment).
> The posted code is the code I use (except for thehttp://w...).
> (and there is a " require 'firewatir'" on top of the code)
>
> cheers.
>
> Angrez wrote:
> > Hi,
>
> > Can you provide with the error message that you are using? Also you
> > are passing URL as a string, but while using in the code you are using
> > it as regexp. Not sure but that could be a problem. Can you please
> > post some values/exact code that you are using?
>
> > Regards,
> > Angrez
>
> --
> Posted viahttp://www.ruby-....

Flaming Flamingo

1/24/2008 9:24:00 AM

0

The links on the website are very big. I use the regexp. /_groupid_ITEM/
to get to the link without having to type the whole link in the code
(groupid_ITEM only appears in one link). And, in the link there are some
items (countrycodes for example) that change with the settings of the
website.

When debugging the code, I did use the whole link, something like this:
self.link(:url,
'http://veryverybiglink_nl_nl_website_groupid_ITEM...)
But this also didn't work...

_groupid_ITEM will eventually change into a variable, but first it has
to work at all :-)

thanks for thinking along...

Angrez wrote:
> Hi,
>
> Your code for function is like this:
>> def clicklink(gui,window,link)
>> #gui, window, link come later....
>> puts "clicklink"
>> self.link(:url, /_groupid_ITEM/)
>> puts "end clicklink"
>> end
>
> But you are not using variable link anywhere? what is use of /
> _groupid_ITEM/? I think I am missing something obvious over here.
>
> - Angrez

--
Posted via http://www.ruby-....

Angrez

1/29/2008 5:33:00 AM

0

Hi,

Can you try getting the latest code from SVN and see it that works?
Because as far as I know link does work using URL and regular
expression. See unit tests for more detail.

- Angrez
On Jan 24, 2:23 pm, Flaming Flamingo <g...@degekste.com> wrote:
> The links on the website are very big. I use the regexp. /_groupid_ITEM/
> to get to the link without having to type the whole link in the code
> (groupid_ITEM only appears in one link). And, in the link there are some
> items (countrycodes for example) that change with the settings of the
> website.
>
> When debugging the code, I did use the whole link, something like this:
> self.link(:url,
> 'http://veryverybiglink_nl_nl_website_groupid_ITEM...)
> But this also didn't work...
>
> _groupid_ITEM will eventually change into a variable, but first it has
> to work at all :-)
>
> thanks for thinking along...
>
> Angrez wrote:
> > Hi,
>
> > Your code for function is like this:
> >> def clicklink(gui,window,link)
> >> #gui, window, link come later....
> >> puts "clicklink"
> >> self.link(:url, /_groupid_ITEM/)
> >> puts "end clicklink"
> >> end
>
> > But you are not using variable link anywhere? what is use of /
> > _groupid_ITEM/? I think I am missing something obvious over here.
>
> > - Angrez
>
> --
> Posted viahttp://www.ruby-....

Flaming Flamingo

1/29/2008 8:20:00 AM

0

Thanks for all the help Angrez, much app.
I will check it if this will help.

Cheers,
FF

Angrez wrote:
> Hi,
>
> Can you try getting the latest code from SVN and see it that works?
> Because as far as I know link does work using URL and regular
> expression. See unit tests for more detail.
>
> - Angrez

--
Posted via http://www.ruby-....

Flaming Flamingo

1/29/2008 2:34:00 PM

0

I tried it...no change.

When I do $ff = FireWatir::Firefox.new() and use @ff in all the classes
(I know, not very nice programming...this is for debug reasons) it
works..
I think it is an inherit problem.

class CLBrowserFF<FireWatir::Firefox isn't correct (but get no message
of it).

The strange thing is:

with inherit:
self.link(:url, /_groupid_ITEM/)

without inherit:
$ff.link(:url, /_groupid_ITEM/).click


notice the .click on the end
The regexpp isn't the problem...

With inherit it says that it doesn't know .click. and without it has to
have a .click. This is weird....

cheers,
FF

Angrez wrote:
> Hi,
>
> Can you try getting the latest code from SVN and see it that works?
> Because as far as I know link does work using URL and regular
> expression. See unit tests for more detail.
>
> - Angrez

--
Posted via http://www.ruby-....