Created
          September 7, 2011 11:28 
        
      - 
      
- 
        Save agirorn/1200330 to your computer and use it in GitHub Desktop. 
    Trigger change event in Capybara
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | module JQueryEventsHelpers | |
| def trigger_change(jQuerySelector) | |
| script = "$('#{jQuerySelector}').trigger('change');" | |
| page.execute_script(script); | |
| end | |
| end | |
| World(JQueryEventsHelpers) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Very nice. This helped me a lot. I forked it and modified to allow triggering any javascript event: