Using JS to enter text, but if I input text in one text box, the value already entered is getting deleted(使用JS输入文字,但是如果我在一个文本框中输入文字,已经输入的值被删除)
问题描述
我连续有3个文本框,我正在使用JS在文本框中输入文本.但问题是当我在一个字段中输入文本并转到第二个框输入文本时,第一个文本框中的值被删除.我们正在使用下面的代码来输入文本
((JavascriptExecutor) webDriver).executeScript("arguments[0].setAttribute('value','"+inputText+"')",元素);
试试下面的:
String js = "arguments[0].setAttribute('value','"+inputText+"')"((JavascriptExecutor) webDriver).executeScript(js, element);
<块引用>
确保在第二个和第三个text
被推送之前,document.readyState == "complete"
已经实现.
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);
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 thedocument.readyState == "complete"
is achieved.
这篇关于使用JS输入文字,但是如果我在一个文本框中输入文字,已经输入的值被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用JS输入文字,但是如果我在一个文本框中输入文字,已经输入的值被删除


- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 失败的 Canvas 360 jquery 插件 2022-01-01