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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In my case, i do not have an iframe with name but only with ID
![screen shot 2017-03-17 at 11 55 10](https://cloud.githubusercontent.com/assets/3852690/24042142/a4c01890-0b08-11e7-923e-304476bfd9a6.png)
and cannot make it work with the above example. Any advise.