# How can I clear the value value of the input box? I try to use cleartext, but the original value is still there after saving

**URL:** <https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [March 14, 2022, 10:21am UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357 "2022-03-14T10:21:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![1968693027](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/1968693027/32/18174_2.png) [@1968693027](https://forum.katalon.com/u/1968693027)\
**Post date:** [March 14, 2022, 10:21am UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/1 "2022-03-14T10:21:32Z")

</div>

How can I clear the value value of the input box? I try to use cleartext, but the original value is still there after saving

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [March 14, 2022, 1:06pm UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/2 "2022-03-14T13:06:15Z")

</div>

I need to see the HTML/DOM – please take a screenshot of the Inspector in [DevTools](http://forum.katalon.com/t/how-to-use-the-browser-developer-tools-f12-devtools/34329).

Also, post the Test Case code you are using.

Thanks.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [March 14, 2022, 6:34pm UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/3 "2022-03-14T18:34:34Z")

</div>

As Russ said, we will need to see the HTML of the field you are trying to clear. Aside from that, I can tell you that WebUI.clearText() (which ultimately uses Selenium’s clear() method) is notoriously flakey, particularly with alternate implementations of text fields. Otherwise, if it’s your standard `<input>` element, it tends to work fine.

The best way to handle clearing text across the board is to select all the text in the field, then send a backspace or delete key. Unfortunately, as far as I know, the first part of that task is not currently doable with the WebUI.sendKeys() method (see [this topic](http://forum.katalon.com/t/webui-sendkeys-should-accept-an-org-openqa-selenium-keys-argument/27991)). Here’s how you could do it with Selenium though:

```
import org.openqa.selenium.*
import com.kms.katalon.core.webui.common.WebUiCommonHelper

WebElement element = WebUiCommonHelper.findWebElement(findTestObject('path/to/object'), 30);
element.sendKeys(Keys.chord(Keys.CONTROL, 'a'));
element.sendKeys(Keys.DELETE);
```

---

<div class="post-metadata">

**Author:** ![1968693027](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/1968693027/32/18174_2.png) [@1968693027](https://forum.katalon.com/u/1968693027)\
**Post date:** [March 19, 2022, 6:03am UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/4 "2022-03-19T06:03:08Z")

</div>

![image](https://europe1.discourse-cdn.com/katalon/original/3X/3/e/3e3377c121e1bc9e0bf2146f31b08650b3849c0a.png)

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [March 19, 2022, 4:43pm UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/5 "2022-03-19T16:43:14Z")

</div>

> [@Russ\_Thomas](#):
>
> Also, post the Test Case code you are using.

And what is the **xpath** you are using to your element?

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [March 19, 2022, 11:38pm UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/6 "2022-03-19T23:38:53Z")

</div>

@1968693027 you might find this useful when working with webpage elements:

> **[XPath in Selenium: How to Find & Write Text, Contains, OR, AND](https://www.guru99.com/xpath-selenium.html)**
>
> In this tutorial, you will learn XPath definition, Types, Basic XPath, Contains, OR & AND, Starts-with Function, XPath Axes Methods, and more.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [March 20, 2022, 11:47pm UTC](https://forum.katalon.com/t/how-can-i-clear-the-value-value-of-the-input-box-i-try-to-use-cleartext-but-the-original-value-is-still-there-after-saving/63357/7 "2022-03-20T23:47:55Z")

</div>

```
import org.openqa.selenium.*
import com.kms.katalon.core.webui.common.*

WebElement element = DriverFactory.getWebDriver().findElement(By.xpath("//input[@id='qa-test-deploy-underlay-new-upMbps-input']"));
element.sendKeys(Keys.chord(Keys.CONTROL, 'a'));
element.sendKeys(Keys.DELETE);
```
