Missing document for WebUI.clearText(TestObject)

I happene to find that there is no document page for the WebUI.clearText(TestObject) is available. Try the following:

This link will get 404 NOT FOUND.

However, com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords class surely implements clearText(TestObject) method. See the source code:

And I checked the following Test Case, and confirmed that the WebUI.clearText() works:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable

WebUI.comment('Story: Login to CURA system')
WebUI.comment('Given that the user has the valid login information')
WebUI.openBrowser(GlobalVariable.G_SiteURL)
WebUI.click(findTestObject('Page_CuraHomepage/btn_MakeAppointment')
WebUI.setText(findTestObject('Page_Login/txt_UserName'), "Fake Name")
WebUI.delay(3)

WebUI.clearText(findTestObject('Page_Login/txt_UserName'))

WebUI.delay(3)
WebUI.setText(findTestObject('Page_Login/txt_UserName'), Username)
WebUI.setText(findTestObject('Page_Login/txt_Password'), Password)
WebUI.comment('When he logins to CURA system')
WebUI.click(findTestObject('Page_Login/btn_Login'))
WebUI.comment('Then he should be able to login successfully')
landingPage = WebUI.verifyElementPresent(findTestObject('Page_CuraAppointment/div_Appointment'), GlobalVariable.G_Timeout)
WebUI.closeBrowser()

There seems to be no reason why we do not have a document for the WebUI.clearText() keyword.

@duyluong
@ThanhTo

Why not?


There are quite a few questions in this forum, which asked “how to clear text?”. I suppose they were lost because they could not find the doc for WebUI.clearText.

Hi @kazurayam,

Thank you for your feedback, we will take a look and improve the document for WebUI.clearText(TestObject) asap. Stay tuned!

Shin

It was reported that WebUI.clearText() does not work for a <input type="number">

<input type="number" id="quantity" name="quantity" min="1" max="5">

See for example

We can guess and understand this mess. A <input type="number"> requires a text value to be a number. Now a question arises. Having blank in the field – is it legal? Is a blank a number?

Well, principally, a blank is not number, a blank should be avoided there.

Then how browsers should react when Katalon Studio called WebUI.clearText() for a <input type="number"> element?

Well, there would be no clear-cut answer. Browsers may behave in various manner.

  • turn the field blank
  • turn it to be the minimum value, or the maximum value, or 0
  • just ignore the clearText() request

A possible approach would be saying that “you should not use WebUI.clearText() for <input type="number"> as the result is not deterministic”

Katalon should explain in the official document something to avoid confusion.

No improvement has been done yet.