如何用水豚和硒填充tinymce-rails编辑器?用水、编辑器、tinymce、rails

2023-09-08 00:21:42 作者:执手浪天涯

我在使用 capybara 测试 tinymce 表单时遇到了麻烦.我正在使用 tinymce-rails 并在我的表单中有 7 个编辑器.我也在使用带有 tinymce 的 asciimath 插件.

I have trouble with using capybara to test tinymce form. I'm using tinymce-rails and have 7 editors in my form. Also I'm using asciimath plugin with tinymce.

一切正常,但我无法编写测试来填充 tinymce 编辑器.

Everything works fine, but I'm unable to write tests to fill in tinymce editor.

这是我的步骤定义代码的样子,与描述的非常相似 这里:

Here is how my step definition code looks like, very similar to what is described here:

within_frame("content_ifr") do
  editor = page.find_by_id('tinymce')
  editor.native.send_keys 'test'
end

问题是当我运行以下命令时:

The problem is when I run the following:

editor.native.clear            # works, clear the editor area, I'm testing this with pry
editor.native.send_keys :tab   # works, moves focus to next input
editor.native.send_keys 'test' # returns "", nothing happens, nothing in editor

所以 clearsend_keys :tab 按预期工作.但我不能发送任何字符串.send_keys 函数总是返回空字符串,当我使用 pry 进行测试时没有任何反应.

So clear and send_keys :tab work as expected. But I can't send any string. send_keys function is always returning empty string, and nothing happens when I do test using pry.

这里出了什么问题?以及如何调试/调查问题?

What is going wrong here? and how can I debug / investigate the problem?

谢谢.

推荐答案

按照描述切换到 chrome 这里解决了我的问题.

Switching to chrome as described here solved my problem.

显然这个问题与 firefox 驱动程序中的错误有关.

Obviously the problem is related with a bug in firefox driver.

我仍然认为这对 firefox 来说是一个有效的问题.

Still i think it is a valid question for firefox.