FireWatir in class, link doesn't work

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')

···

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

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://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')
--
Posted viahttp://www.ruby-forum.com/.

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.

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-forum.com/\.

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://website.com).
(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-forum.com/.

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 :slight_smile:

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-forum.com/\.

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.html')
But this also didn't work...

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

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-forum.com/.

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-forum.com/\.

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-forum.com/\.