Hi,
Is there is any way to clear text from input fields in web?
You can set the value ‘’ to the input object with the Keyword “Set Text” and the input will raplace the new value to the old one.
Hi,
I need to check backspace functionality in the text field, please give solution for this?
In that case you can send a the backspace key to the input.
1.- Add a new “Web UI Keyword”
2.- Choose the keyword “Send Keys”
3.- Doubleclick on the object column and find the object that you want to send the key (they original value to your object is null)
4.- Doubleclick on the Input column. Katalon will show you a new modal with others columns.
5.- Change the value type “String” to “Keys”
6.- Doubleclick on the column value. Katalon will show you other modal and you can tap the keys directly to your keyboard or choose it/write it by yourself.
Or if you want you can copy and paste the next line to your script but you need to change the object value to a real object in your proyect.
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.BACK_SPACE))
Let me know if it works for you
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.BACK_SPACE)), clears only a single character, is there any way to clear the string?
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.CONTROL, ‘a’))
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.BACK_SPACE))
This works for me, imitates “select all” and “delete” commands…
use WebUI.clearText()
ariba_s4katalon said:
use WebUI.clearText()
WebUI.clearText() really exist ? I can find Mobile.clearText() but strangely not WebUI.clearText() …
WebUI.clearText() doesn’t work in MacOSX for webelement : //input[@type = ‘number’ and @name = ‘length’]
Have tried Command+A using Keys.chord and it doesn’t work either.
Surprisingly,everything works in Windows.
There is some workaround here:
On Mac Os, I used:
WebUI.doubleClick(obj_repository)
WebUI.sendKeys(obj_repository, Keys.chord(Keys.DELETE))
It works for me
That’s what I said, it doesn’t work in mac os x for me too. After their recent announcements of commercialisation of command line paid features, we scrapped using it anymore. Try nightwatch, cypress and Coypu atleast they are open source.
It is not working in katalon 7.4.0
Amazing! thanks!
Perfect! Thanks
A built-in keyword
WebUI.clearText(TestObject)
is available. It works just as the art of sendKeys
. But unfortunately it is not documented, so nobody knows.
See also:
Here is a generic way working no matter if you are working Windows or Mac.
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.SHIFT, Keys.ARROW_UP))
WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.BACK_SPACE))
This did the trick for me!
Hi @pranesh,
Long time no see, we hope you are doing well!
We are seeing quite a lot of discussions within your topic, and it seems that other members have proposed suitable answers to your questions. However, it would help if you could pick one out as a definitive answer by marking it as a solution by following the video below.
This way, it will help newcomers to our forum who may be having the same question as you did to reach the solution faster.
Thanks