本文介绍了使用JS输入文字,但是如果我在一个文本框中输入文字,已经输入的值被删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
限时送ChatGPT账号..
我连续有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
textis being pushed thedocument.readyState == "complete"is achieved.
这篇关于使用JS输入文字,但是如果我在一个文本框中输入文字,已经输入的值被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)