Watir is able to fire an event for a select list if there are events
of the required type registered to the element. If, however, there are
no objects registered via JavaScript to the select element, then it
fails.

>From a testing stand point for a JavaScript rich application, it would
be nice to be able to fire the event and have it succeed even if there
are no registered events. The test code can then be far more versatile
and general.

Versions:
IE 8.0.6001.18702
Ruby 1.9.2p180
Watir 1.9.1.rc1

HTML Code Sample:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <title>fire event sample</title>
 </head>
  <body>
    <select name="select">
      <option value="1">value1</option>
      <option value="2">value2</option>
    </select>
  </body>
</html>

Ruby Code Sample:
require 'watir'
browser = Watir::Browser.new
browser.goto "http://<path.to>/testPage.html"
browser.select_list(:name, 'select').fire_event('change')

Expected Result:
Code should execute without any errors, firing events if there were
any, and otherwise doing nothing (just like the equivalent behaviour
in JavaScript).

Actual Result:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.9.1.rc1/lib/watir/
element.rb:339:in `method_missing': (in OLE method `fireEvent': )
(WIN32OLERuntimeError)
    OLE error code:80070057 in htmlfile
      Invalid argument.
    HRESULT error code:0x80020009
      Exception occurred.
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.9.1.rc1/lib/
watir/element.rb:339:in `dispatch_event'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.9.1.rc1/lib/
watir/element.rb:325:in `fire_event'
        from IE8FireEventBug.rb:21:in `<main>'

Let me know what you think. :-)

Thanks!
Michael

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to