FireWatir bug/anomaly

11 views
Skip to first unread message

Chris

unread,
Apr 5, 2009, 12:07:04 AM4/5/09
to Watir General

This snippet show the issue on FF3/Mac. select_list on craigslist
seems to be invisible. FWIW, Selenium IDE can address the select_list
with no problem

require 'rubygems'
require 'firewatir'

@browser = Watir::Browser.new
@browser.goto("http://newyork.craigslist.org/jjj/")

#CAN'T ADDRESS BY INDEX
@browser.select_list(:index,1).set("software jobs")
#CAN'T ADDRESS BY ID
@browser.select_list(:id,"cAbb").set("software jobs")
#CAN'T SET THE select_list VIA 'value=foo'
@browser.select_list(:id,"cAbb").set("sof")

FireWatir generates no error for any of these calls.

Jarmo Pertman

unread,
Apr 11, 2009, 7:07:12 PM4/11/09
to Watir General
Try to print out html for that select_list to make sure that you are
really dealing with the correct select_list and there aren't any
hidden ones or whatsoever. Or try just plain old .flash method to see
if correct list is flashing :)

Jarmo

Alex Collins

unread,
Apr 12, 2009, 6:02:56 AM4/12/09
to watir-...@googlegroups.com
I've just had a quick look, also on FF3/Mac.

The issue is not that the select_list element is invisible - you can
address it correctly as show by calling:
@browser.select_lists
or
@browser.select_list(:id, 'cAbb')

Calling the "methods" method on the element reveals that the "set"
method you are calling is not present. I was surprised to see that
this method exists - I've always used the "select" method, which works
fine. The RDoc reveals that set should be an alias for select.

I would suggest using the select method for the time being:
@browser.select_list(:id,"cAbb").select("software jobs")

However, if you wish to use the set method, add the following code to
your firewatir/htmlelements.rb file in the SelectList class beneath
the select method's definition:
alias :set :select

Best wishes,

Alex

Chris McMahon

unread,
Apr 12, 2009, 10:16:09 AM4/12/09
to Watir General

> Calling the "methods" method on the element reveals that the "set"  
> method you are calling is not present. I was surprised to see that  
> this method exists - I've always used the "select" method, which works  
> fine. The RDoc reveals that set should be an alias for select.
>
> I would suggest using the select method for the time being:
> @browser.select_list(:id,"cAbb").select("software jobs")
>
> However, if you wish to use the set method, add the following code to  
> your firewatir/htmlelements.rb file in the SelectList class beneath  
> the select method's definition:
> alias :set :select

Alex, thanks very much. I should have thought of some of that
myself-- it has been some time since I've worked closely with Watir.

Seems like I should have gotten a NoMethodError trying what I did, but
I'm glad that there *is* a right method.

-Chris

Paul Rogers

unread,
Apr 12, 2009, 10:20:25 PM4/12/09
to watir-...@googlegroups.com
there is some functionality in firewatir ( at least the version that I had been using) that doesnt generate exceptions when there is a javascript exception. Id fixed this some where once ( probably in a local copy of firewatir) , but I guess the code got lost

Paul

Angrez Singh

unread,
Apr 13, 2009, 3:04:46 AM4/13/09
to watir-...@googlegroups.com
Can somebody put this in JIRA so that we can make Firewatir/Watir more compatible?

- Angrez

Bret Pettichord

unread,
Apr 13, 2009, 2:59:53 PM4/13/09
to watir-...@googlegroups.com
I think there are 2 bugs here.

1. Firewatir does not issue an error when users use undefined methods.

2. SelectList#set needs to be defined as an alias for SelectList#select
(as it is in IE-Watir).

Bret
> <mailto:christopher.mcma...@gmail.com>> wrote:
> >> This snippet show the issue on FF3/Mac. select_list on craigslist
> >> seems to be invisible. FWIW, Selenium IDE can address the
> >> select_list
> >> with no problem
> >>
> >> require 'rubygems'
> >> require 'firewatir'
> >>
> >> @browser = Watir::Browser.new
> >> @browser.goto("http://newyork.craigslist.org/jjj/")
> >>
> >> #CAN'T ADDRESS BY INDEX
> >> @browser.select_list(:index,1).set("software jobs")
> >> #CAN'T ADDRESS BY ID
> >> @browser.select_list(:id,"cAbb").set("software jobs")
> >> #CAN'T SET THE select_list VIA 'value=foo'
> >> @browser.select_list(:id,"cAbb").set("sof")
> >>
> >> FireWatir generates no error for any of these calls.
> > >
>
>
>
>
>
> >


--
Bret Pettichord
CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Watir Training: Portland/Beaverton April 16-17
www.watircraft.com/training

Alex Collins

unread,
Apr 13, 2009, 4:21:36 PM4/13/09
to watir-...@googlegroups.com

On 13 Apr 2009, at 19:59, Bret Pettichord wrote:
> I think there are 2 bugs here.
>
> 1. Firewatir does not issue an error when users use undefined methods.

Agree with this. I had a quick look but my trivial catch-all patch
breaks various tests. I'll have a look tomorrow at fitting this into
element.rb's method_missing call.

> 2. SelectList#set needs to be defined as an alias for
> SelectList#select
> (as it is in IE-Watir).

I checked this morning - this is already fixed in the firewatir on
GitHub in Bret's Watir repository.

Alex

Reply all
Reply to author
Forward
0 new messages