[ 
http://jira.openqa.org/browse/WTR-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20237#action_20237
 ] 

Jarmo Pertman commented on WTR-485:
-----------------------------------

The problem is that you're trying to fire a non-existing event - "change". The 
correct event would be "onchange". I modified your html to have an onChange 
handler registerd to it:
<select name="select" onchange="alert(1)"> 

Now if you select other value, you will get an JavaScript alert window, try it 
out manually.

Now, this triggers the window too:
b.select_list(:name, 'select').fire_event('onchange')

And if you select the value:
b.select_list(:name, 'select').select('value2')

So, as a matter of fact, it does trigger the "onChange" event automatically 
too. If you have some other custom events binded to that select then they won't 
be triggered of course and you'd have to fire them manually. If you cannot fire 
then with #fire_event, then try #execute_script and use the JavaScript 
framework which is used on the page like jQuery, Prototype or some other.

May i close this issue now or are you still having problems?

> Waitr fails to fire_event for select_list
> -----------------------------------------
>
>                 Key: WTR-485
>                 URL: http://jira.openqa.org/browse/WTR-485
>             Project: Watir
>          Issue Type: Bug
>          Components: Inputs
>    Affects Versions: 1.8.0
>         Environment: Windows XP SP3 (64-bit), Internet Explorer 
> 8.0.6001.18702 (32-bit)
>            Reporter: Michael M
>            Priority: Major
>
> 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.
> Versions: 
> 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>' 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to