1

I have 3 text box in a row, and I am using JS to input the texts in the text boxes. But the problem is when I enter the text in one field, and go to second box to enter the text, the value from first text box is removed. we are using the below code to input text

((JavascriptExecutor) webDriver).executeScript(
  "arguments[0].setAttribute('value','"+inputText+"')",
  element);
mplungjan
  • 169,008
  • 28
  • 173
  • 236
Alapan Das
  • 17,144
  • 3
  • 29
  • 52

1 Answers1

1

Try the following :

String js = "arguments[0].setAttribute('value','"+inputText+"')"
((JavascriptExecutor) webDriver).executeScript(js, element);

Ensure that the before the second and third text is being pushed the document.readyState == "complete" is achieved.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352