问题描述
我在rspec中进行了此功能测试
fill_in "Name","title"
#fill_in "Body","my blog" # this is the old implementation before tinymce
within_frame("mce_0_ifr") do
page.driver.browser.find_element(:id,'tinymce').send_keys("blog 123")
puts page.html
end
click_button "Submit"
从输出中,我可以清楚地看到“ blog 123”一词是通过以下方式写在正文中的:
<body id="tinymce"><p>blog 123</p></body>
解决方法
结果证明代码很好。由于tinymce和html5所需的验证无法协同工作,导致出现错误。因此,永远不会发送数据,并且水豚会移动到下一个期望值,从而导致错误。万一有人遇到这个问题,我会贴出解决方法。
<script>
tinymce.init({
selector: "textarea.tinymce",editor.on('change',function () {
editor.save();
})
})
</script>