Created
November 1, 2012 19:23
-
-
Save gacha/3995845 to your computer and use it in GitHub Desktop.
Fill in text into tinymce for capybara, using native input for selenium and JS for other
This file contains 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
# used as example https://groups.google.com/d/msg/ruby-capybara/XhDAHGjZSjA/VwiW0-2nOIEJ | |
# IMPORTANT! To do the real simulation you need chrome driver - http://code.google.com/p/selenium/downloads/list, download and add to PATH | |
def tinymce_fill_in name, options = {} | |
if page.driver.browser.browser == :chrome | |
page.driver.browser.switch_to.frame("#{name}_ifr") | |
page.find(:css, '#tinymce').native.send_keys(options[:with]) | |
page.driver.browser.switch_to.default_content | |
else | |
page.execute_script("tinyMCE.get('#{name}').setContent('#{options[:with]}')") | |
end | |
end |
This is exactly what I needed :) Thanks
Very useful!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is AWESOME, thanks!