小编jim*_*jim的帖子

htmlunit java更改输入文本

我用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)

请帮忙!

java htmlunit

6
推荐指数
2
解决办法
9489
查看次数

标签 统计

htmlunit ×1

java ×1