Using Watir Webdriver and WYSIWYG



使用Watir Webdriver,我能够检测到所见即所得的ckeditor存在,但是任何send_keys它的尝试都会输出一个空白字符串?

我能够毫无问题地使用 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"标签点击的框架元素):

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

最新更新