Я нашел решение, используя метод JQuery resizable (). Чтобы использовать его в проекте GWT, я использовал JSNI (собственный интерфейс Javascript) для интеграции кода Javascript в ваш проект GWT.
Шаги
Пример
Шаг 1. Установите идентификатор элемента:
private final String TEXT_AREA_ID = HTMLPanel.createUniqueId();
textArea.getElement().setId(TEXT_AREA_ID);
Шаг 2. На вашей странице index.html / jsp Добавьте это:
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
Шаг 3. Создайте свой метод JSNI:
public class JSNIResizer
{
public static native void resize(String textAreaId) /*-{
// Internet Explorer. IE 11 uses 'trident'.
var isIE = ($wnd.navigator.userAgent.match(/msie/i) || $wnd.navigator.userAgent.match(/trident/i));
// Only apply this to IE browsers
if (isIE) {
var textArea = $wnd.$("#" + textAreaId);
if (textArea) {
textArea.resizable({
handles : 'n, s' // handle vertical resizing only.
});
// Optional: Adds a css style from jquery-ui.css
textArea.addClass("ui-widget-content");
}
}
}-*/;
}
Обратите внимание, что вы можете сделать это, если не хотите ограничивать его только вертикальным изменением размера: [ 1116]
textArea.resizable();
Шаг 4. Назовите его с идентификатором элемента для изменения размера:
JSNIResizer.resize(TEXT_AREA_ID);
EDIT: Upon further inspection, I found that the standard way of sending the ENTER key doesn't work in WatiN as it does in WatiR. You need to use System.Windows.Forms.SendKeys
Also, I recommend that you download the WatiN Test Recorder.
Here's the sample code.
using(IE ie = new IE("http://someurl"))
{
TextField myTxt = ie.TextField(Find.ById("myTextBox")).TypeText("some value");
System.Windows.Forms.SendKeys.SendWait("{ENTER}");
}