【问题标题】:Functional testing for redactor textarea by gebgeb 对编辑器 textarea 的功能测试
【发布时间】:2014-01-09 06:22:27
【问题描述】:

我正在尝试在 redctor 文本字段中输入文本以测试 geb 的功能测试。但我无法这样做,因为 textarea 是不可见的。当它是简单的 html 文本字段时,我无法通过个人@ 987654321@ 但在这种情况下它不起作用。我在 testspec 中也使用过这样的个人陈述 =“我在这里”,但没有工作。

<div class="redactor_redactor_content_cv redactor_ui-wizard-content redactor_editor" 

  contenteditable="true" dir="ltr" style="min-height: 200px;"> <p>​</p> </div> <textarea 

   id="personalStatement" class="redactor_content_cv ui-wizard-content" width="98%" 

   height="100px" name="personalStatement" dir="ltr" style="display: none;"> </textarea>

【问题讨论】:

  • 如果它确实有效,我会感到惊讶。 Geb(和 Selenium)与 UI 交互。在这里,您实际上是在尝试模拟用户在不可见的字段中键入内容,这是不能(不应该)完成的。我怀疑您必须使用 js.exec 或一些巧妙的 CSS 技巧来隐蔽地显示该字段,然后才能使用 Geb 与之交互。

标签: grails spock geb


【解决方案1】:

使用发送键方法在 textarea 中输入值。

$("#personalStatement").firstElement().sendKeys("Test")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-09
    • 1970-01-01
    • 1970-01-01
    • 2013-02-26
    • 1970-01-01
    • 2012-05-06
    • 2012-10-14
    相关资源
    最近更新 更多