简体   繁体   中英

Using Watir Webdriver and WYSIWYG

Using Watir Webdriver I am able to detect that a WYSIWYG ckeditor exists, however any attempt to send_keys to it outputs a blank string?

I am able to run the test above with the ckeditor without issues:

require "watir-webdriver"
b = Watir::Browser.new :firefox
b.goto "http://ckeditor.com/demo"
b.frame(:title => 'Rich text editor, editor1, press ALT 0 for help.').send_keys "hello world"

I am however, having an issue running this code for my own test:

b.frame(:title, "Rich text editor, currentItem.contentText, press ALT 0 for help.").exists?
=> true

b.frame(:title, "Rich text editor, currentItem.contentText, press ALT 0 for help.").send_keys 'text'
=>""

Nothing is rendered to WYSIWYG. Other frames on webpage allow me to edit text fields. Any thoughts?

Generally speaking sending keys to a whole frame is a bad idea.

In my own experience with the FCKEditor, I've only gotten it to work if I find the specific element that can respond to the .send_keys method.

Here's an example of something that works for me (I am guessing that my first frame element reference is going to be equivalent to the frame element you're hitting using the "title" tag):

@browser.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys "your text here"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM