使用JS输入文字,在一个文本框中输入文字,已经输入的值被删除
Using JS to enter text, but if I input text in one text box, the value already entered is getting deleted
我有3个连续的文本框,我用JS在文本框中输入文本。但问题是当我在一个字段中输入文本,然后转到第二个框输入文本时,第一个文本框中的值被删除。我们使用下面的代码输入文本
((JavascriptExecutor) webDriver).executeScript(
"arguments[0].setAttribute('value','"+inputText+"')",
element);
尝试以下操作:
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.
我有3个连续的文本框,我用JS在文本框中输入文本。但问题是当我在一个字段中输入文本,然后转到第二个框输入文本时,第一个文本框中的值被删除。我们使用下面的代码输入文本
((JavascriptExecutor) webDriver).executeScript(
"arguments[0].setAttribute('value','"+inputText+"')",
element);
尝试以下操作:
String js = "arguments[0].setAttribute('value','"+inputText+"')"
((JavascriptExecutor) webDriver).executeScript(js, element);
Ensure that the before the second and third
text
is being pushed thedocument.readyState == "complete"
is achieved.