htmlunit java更改输入文本

jim*_*jim 6 java htmlunit

我用htmlunit.如果没有属性'value',我如何设置文本输入的值?

<input type="text" onkeypress="test();" id="id" name="name" class="ttt">
Run Code Online (Sandbox Code Playgroud)

我尝试了这个,但没有

    ((HtmlTextInput) portfolios.getHtmlElementById("id")).setText("text");
    ((HtmlInput) portfolios.getHtmlElementById("id")).setTextContent("text");
    ((HtmlInput) portfolios.getHtmlElementById("id")).setAttribute("value", "text");
Run Code Online (Sandbox Code Playgroud)

请帮忙!

小智 9

HtmlInput intputBox = (HtmlInput)portfolios.getHtmlElementById('id');

intputBox.setValueAttribute("text");
Run Code Online (Sandbox Code Playgroud)