Ruby 使用Watir Webdriver和WYSIWYG

Ruby 使用Watir Webdriver和WYSIWYG,ruby,watir,watir-webdriver,Ruby,Watir,Watir Webdriver,使用Watir Webdriver,我能够检测到WYSIWYG ckeditor是否存在,但是任何尝试向其发送密钥的操作都会输出一个空白字符串 我能够使用ckeditor运行上述测试,没有问题: require "watir-webdriver" b = Watir::Browser.new :firefox b.goto "http://ckeditor.com/demo" b.frame(:title => 'Rich text editor, editor1, press ALT 0

使用Watir Webdriver,我能够检测到WYSIWYG ckeditor是否存在,但是任何尝试
向其发送密钥的操作都会输出一个空白字符串

我能够使用ckeditor运行上述测试,没有问题:

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"
但是,我在为自己的测试运行此代码时遇到了一个问题:

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'
=>""
不向所见即所得呈现任何内容。
网页上的其他框架允许我编辑文本字段。有什么想法吗?

一般来说,给整个画面发送按键是个坏主意

根据我自己使用FCKEditor的经验,只有在找到能够响应.send_keys方法的特定元素时,我才能让它工作

下面是一个对我有用的示例(我猜我的第一个框架元素引用将等同于使用“title”标记命中的框架元素):


我不希望使用execute_脚本方法,因为它会使我的测试无效。为什么使用execute_脚本方法会使您的测试无效?除非您真的在开发自己的所见即所得编辑器,否则您不是在测试编辑器,而是可以使用它向应用程序添加内容,这是通过execute_script方法实现的?
@browser.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys "your text here"