[这是我的HTML和web应用程序](
https://i.stack.imgur.com/nHfgC.png
)
这是我的代码:
@Test(priority = 9)
public void EditCompositeLevel() throws InterruptedException {
// Wait for the 'Name' input field to be present and clear its content
WebElement nameInput=driver.findElement(By.xpath("//input[@type='text' and @placeholder='Name']"));
Thread.sleep(3000);
nameInput.clear();
Thread.sleep(3000);
System.out.println( driver.findElement(By.xpath("(//input[@placeholder='Name'])[1]")).getText()
) ;
Thread.sleep(3000);
System.out.println( driver.findElement(By.xpath("(//input[@placeholder='Name'])[1]")).getText());
}
我尝试使用webobject-object.clear()来清除输入字段;
然后我想使用webobject对象sendkeys发送输入值。但它在我发送键之前保留了以前的输入值