开发者

htmlunit java change input text

开发者 https://www.devze.com 2023-02-15 20:28 出处:网络
I use htmlunit. How i can set value of text input if it does not have an attribute \'value\' ? <input type=\"text\" onkeypress=\"test();\" id=\"id\" name=\"name\" class=\"ttt\">

I use htmlunit. How i can set value of text input if it does not have an attribute 'value' ?

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

I tried this, but nothing

    ((HtmlTextInput) portfolios.getHtmlElementById("id")).setText("text");
    ((HtmlInput) portfolio开发者_JAVA百科s.getHtmlElementById("id")).setTextContent("text");
    ((HtmlInput) portfolios.getHtmlElementById("id")).setAttribute("value", "text");

Please help!


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

intputBox.setValueAttribute("text");


Does HtmlInput.setValueAttribute() help?

0

精彩评论

暂无评论...
验证码 换一张
取 消