FireWatir in class, link doesn't work.

F

Flaming Flamingo

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://website.com')
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')
 
A

Angrez

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
 
F

Flaming Flamingo

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://website.com).
(and there is a " require 'firewatir'" on top of the code)

cheers.
 
A

Angrez

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
 
F

Flaming Flamingo

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.html')
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...
 
A

Angrez

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
 
F

Flaming Flamingo

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

Cheers,
FF
 
F

Flaming Flamingo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top