Htmlunit java input text

I am using htmlunit. How can I set a text input value if it does not have a value attribute?

<input type="text" onkeypress="test();" id="id" name="name" class="ttt">

I tried this but nothing

    ((HtmlTextInput) portfolios.getHtmlElementById("id")).setText("text");
    ((HtmlInput) portfolios.getHtmlElementById("id")).setTextContent("text");
    ((HtmlInput) portfolios.getHtmlElementById("id")).setAttribute("value", "text");

Please, help!

+5
source share
2 answers
HtmlInput intputBox = (HtmlInput)portfolios.getHtmlElementById('id');

intputBox.setValueAttribute("text");
+7
source

All Articles