作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
在 WebDriver 中,如果我使用 sendKeys,它会将我的字符串附加到字段中已经存在的值。我无法使用 clear() 方法清除它,因为第二次这样做,网页会抛出一个错误,说它必须在 10 到 100 之间。所以我无法清除它,否则之前会抛出错误我可以使用 sendKeys 输入新值,如果我 sendKeys 它只是将它附加到已经存在的值。
WebDriver 中是否有任何内容可以让您覆盖字段中的值?
最佳答案
您也可以在发送 key 之前清除该字段。
element.clear()
element.sendKeys("Some text here")
关于java - Selenium WebDriver : I want to overwrite value in field instead of appending to it with sendKeys using Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3249583/
我是一名优秀的程序员,十分优秀!