gpt4 book ai didi

java - Selenium WebDriver : I want to overwrite value in field instead of appending to it with sendKeys using Java

转载 作者:IT老高 更新时间:2023-10-28 13:52:53 27 4
gpt4 key购买 nike

在 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com