We just recently relocated stuff all under Watir on github, looks like we 
failed to take into account the link in the readme.  I'll either figure out 
how to fix it myself and give them a pull request.  Long past time I 
learned to properly use GIT and how to contribute code (even if just a text 
file, or docs) to the project. 

On Wednesday, May 2, 2012 1:52:39 PM UTC-7, mndude wrote:
>
> That API is linked from the https://github.com/watir/watir-webdriverlink.  
> Scroll down to README.md for the link.  Is there a link to a more 
> current version?
>
> Also right at the top of the page at the new link is a link to the old 
> one.  No wonder I'm confused.  Thanks for sorting that out. :)
>
> I was trying to find out about that "bubble" and I think that is what lets 
> the click through to a parent item.
>
> On Wednesday, May 2, 2012 3:12:49 PM UTC-5, Chuck van der Linden wrote:
>>
>> You are looking at an old version of the repository, things have moved, 
>> you want https://github.com/watir/watir-webdriver  
>>
>> I don't know what the 'bubble' parameter was doing, but it has been 
>> removed in the current code (which has that definition on line 246 as 
>> indicated by your error.  
>>
>>      def fire_event(event_name)
>>
>>       assert_exists
>>       event_name = event_name.to_s.sub(/^on/, '').downcase
>>
>>       execute_atom :fireEvent, @element, event_name
>>     end
>>
>>  
>> The events are a standard javascript thing, within the html  that's where 
>> the names are defined etc.  See :
>> http://www.w3schools.com/tags/ref_eventattributes.asp for a list of the 
>> event names defined when HTML4 came out.
>>
>> 'true' is a string, the code fragment you provided below shows 
>> a Boolean being used, e.g.  true without quotes.  however since that 
>> second parameter is no longer in the current code it's pretty much not 
>> relevant either way
>>
>> The error means that the code on the line indicated (which you did not 
>> look at) only accepts a single parameter and you provided two parameters, 
>> which makes perfect sense if you are looking at the code that is executing 
>> on your system and not an older version of the code.   (Where did you find 
>> that by the way, as I think we may need to update some links if there is 
>> something pointing you to the old watir-webdriver that started out under 
>> Jarib's github and has since moved under Watir to put everything in one 
>> place going forward. 
>>  
>>
>>>
>>>
>>>
>>> On Tuesday, May 1, 2012 11:40:58 AM UTC-5, Chuck van der Linden wrote:
>>>>
>>>> your snippet is from lines 134-138 in element.rb   The error is 
>>>> originating on line 246
>>>>
>>>> also I do not think 'click' is a valid eventname  I think you want 
>>>> 'onclick'  (although the code internally seems to strip the 'on' off so 
>>>> that may not matter, still as a matter of form I prefer the code someone 
>>>> is 
>>>> reading have event names that match what any javascript etc would tend to 
>>>> be looking for, just so it makes more sense to any developer who might not 
>>>> know the watir internals and is looking at my code trying to debug a 
>>>> problem or fix his or my bugs or something) 
>>>>
>>>> in addition to that, I'm not sure ':true' (a symbol since it starts 
>>>> with a colon) will automagically cast into a boolean, you may just want 
>>>> 'true' (sans quotes) 
>>>>
>>>> On Tuesday, May 1, 2012 9:15:08 AM UTC-7, mndude wrote:
>>>>>
>>>>> Maybe because I'm new to ruby I'm reading the API docs wrong but...
>>>>>
>>>>> I'm looking at this page 
>>>>> http://jarib.github.com/watir-webdriver/doc/Watir/Element.html#fire_event-instance_method
>>>>>
>>>>> Where it says:
>>>>>
>>>>> - (Object<http://jarib.github.com/watir-webdriver/doc/Watir/Object.html>) 
>>>>> *fire_event*(event_name, bubble = false) 
>>>>> [Hide 
>>>>> source<http://jarib.github.com/watir-webdriver/doc/Watir/Element.html#>
>>>>> ] 
>>>>>
>>>>> 134
>>>>> 135
>>>>> 136
>>>>> 137
>>>>> 138
>>>>>
>>>>>  # File 'lib/watir-webdriver/elements/element.rb', line 134
>>>>> def fire_event(event_name, bubble = false)
>>>>>   assert_exists
>>>>>   event_name = event_name.to_s.sub(/^on/, '')
>>>>>   browserbot('triggerEvent', @element, event_name, bubble)end
>>>>>
>>>>>
>>>>> But, if I try to execute fire_event with 2 arguments I get an error:
>>>>>
>>>>> irb(main):013:0> button.fire_event( 'click', :true )
>>>>> ArgumentError: wrong number of arguments (2 for 1)
>>>>>         from 
>>>>> C:/Ruby/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.5.5/lib/watir-webdriver/elements/element.rb:246:in
>>>>>  
>>>>> `fire_event'
>>>>>         from (irb):13
>>>>>         from C:/Ruby/bin/irb:12:in `<main>'
>>>>>
>>>>
>> On Tuesday, May 1, 2012 12:03:07 PM UTC-7, mndude wrote:
>>>
>>>
>>> The snippet is direct from that API doc and seems to imply that I can 
>>> pass 2 parameters in.  What does the error "ArgumentError: wrong number of 
>>> arguments (2 for 1)" mean?  Is this just a bug in this API?
>>>
>>> Once I've located a button, "button.fire_event 'click'" does work to 
>>> click the button.  So does 'onclick' instead of 'click'.  I guess what is 
>>> unclear to me is what exactly Watir's fire_event will take for the 
>>> event_name parameter.  Is event_name something from Watir or is it what I 
>>> can see when Firebug is logging events in the Firebug Console?  Or 
>>> something else?
>>>
>>> I can try to send 'onclick', 'true', but that gives the same error:
>>>
>>> irb(main):015:0> button.fire_event 'onclick', 'true'
>>> ArgumentError: wrong number of arguments (2 for 1)
>>>         from 
>>> C:/Ruby/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.5.5/lib/watir-webdriver/elements/element.rb:246:in
>>>  
>>> `fir
>>> _event'
>>>         from (irb):15
>>>         from C:/Ruby/bin/irb:12:in `<main>'
>>>
>>> These are the Firebug events I'm talking about.
>>>
>>>
>>> <https://lh6.googleusercontent.com/-XcP50cSWKrQ/T6AybM4xTyI/AAAAAAAAAJQ/T8o9K7zRxtI/s1600/5-1-2012-0002.png>
>>>
>>>
>>>
>>>
>>> On Tuesday, May 1, 2012 11:40:58 AM UTC-5, Chuck van der Linden wrote:
>>>>
>>>> your snippet is from lines 134-138 in element.rb   The error is 
>>>> originating on line 246
>>>>
>>>> also I do not think 'click' is a valid eventname  I think you want 
>>>> 'onclick'  (although the code internally seems to strip the 'on' off so 
>>>> that may not matter, still as a matter of form I prefer the code someone 
>>>> is 
>>>> reading have event names that match what any javascript etc would tend to 
>>>> be looking for, just so it makes more sense to any developer who might not 
>>>> know the watir internals and is looking at my code trying to debug a 
>>>> problem or fix his or my bugs or something) 
>>>>
>>>> in addition to that, I'm not sure ':true' (a symbol since it starts 
>>>> with a colon) will automagically cast into a boolean, you may just want 
>>>> 'true' (sans quotes) 
>>>>
>>>> On Tuesday, May 1, 2012 9:15:08 AM UTC-7, mndude wrote:
>>>>>
>>>>> Maybe because I'm new to ruby I'm reading the API docs wrong but...
>>>>>
>>>>> I'm looking at this page 
>>>>> http://jarib.github.com/watir-webdriver/doc/Watir/Element.html#fire_event-instance_method
>>>>>
>>>>> Where it says:
>>>>>
>>>>> - (Object<http://jarib.github.com/watir-webdriver/doc/Watir/Object.html>) 
>>>>> *fire_event*(event_name, bubble = false) 
>>>>> [Hide 
>>>>> source<http://jarib.github.com/watir-webdriver/doc/Watir/Element.html#>
>>>>> ] 
>>>>>
>>>>> 134
>>>>> 135
>>>>> 136
>>>>> 137
>>>>> 138
>>>>>
>>>>>  # File 'lib/watir-webdriver/elements/element.rb', line 134
>>>>> def fire_event(event_name, bubble = false)
>>>>>   assert_exists
>>>>>   event_name = event_name.to_s.sub(/^on/, '')
>>>>>   browserbot('triggerEvent', @element, event_name, bubble)end
>>>>>
>>>>>
>>>>> But, if I try to execute fire_event with 2 arguments I get an error:
>>>>>
>>>>> irb(main):013:0> button.fire_event( 'click', :true )
>>>>> ArgumentError: wrong number of arguments (2 for 1)
>>>>>         from 
>>>>> C:/Ruby/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.5.5/lib/watir-webdriver/elements/element.rb:246:in
>>>>>  
>>>>> `fire_event'
>>>>>         from (irb):13
>>>>>         from C:/Ruby/bin/irb:12:in `<main>'
>>>>>
>>>>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to