selenium clear() command doesn't clear the element

前端 未结 8 1287
旧时难觅i
旧时难觅i 2021-01-11 21:14

I have been writing selenium scripts for a while in Java. I encountered a very weird issue today.

Here is the issue: I cleared a text field using webelement.clear()

8条回答
  •  遥遥无期
    2021-01-11 21:56

    Hope this helps to clear the field and then sendKeys() the needed value

     while (!inputField.getAttribute("value").equals("")) {
            inputField.sendKeys(Keys.BACK_SPACE);
           }
            inputField.sendKeys("your_value");
    

提交回复
热议问题