0

The HTML element below is part of a form:

<input id="code" type="text" name="code" placeholder="Enter code here" autocomplete="off"/>

I would like to pass a string to this element. I do not know how to pass a string without a value attribute.

cheyrico2
  • 359
  • 1
  • 3
  • 17

1 Answers1

1

You can try to pass the string to the input by using setText() method:

HtmlTextInput input = (HtmlTextInput) page.getElementById("code");
input.setText("your_text");

or type() method:

HtmlTextInput input = (HtmlTextInput) page.getElementById("code");
input.type("your_text");
haihui
  • 1,075
  • 1
  • 18
  • 25