2014-01-09 49 views
0

我想在redctor文本域中輸入文本來測試通過geb.But的功能測試,但我不能這樣做,因爲textarea是不可見的。當它是簡單的HTML文本字段比我能夠通過個人{$("#personalStatement").value("hi I AM HERE")}這樣做,但在這種情況下,它不工作。我已經在像這樣的testspec中使用也personalStatement =「我在這裏」,但不是woking。通過geb功能測試的redactor textarea通過geb

<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> 

+1

添加你的測試代碼 – plsgogame

+0

我會感到驚訝,如果確實能工作。 Geb(和Selenium)與UI進行交互。在這裏,你有效地試圖模擬用戶輸入到不可見字段中,而不能(不應該)完成。我懷疑你必須使用'js.exec'或者一些聰明的CSS技巧來在你使用Geb進行交互之前悄悄地顯示這個字段。 – inanutshellus

回答

0

發送使用在textarea的輸入值的鍵方法。

$( 「#personalStatement」)。firstElement()的SendKeys( 「測試」)