How to clear textbox?

In selenium we have to used clear keyword for clearing watermark effect but in katalon studio there is not keyword.

Try this method:

def ClearTextField(TestObject to) { WebUI.sendKeys(to, Keys.chord(Keys.CONTROL, 'a')) WebUI.sendKeys(to, Keys.chord(Keys.DELETE)) }

1 Like

Keys.chord(Keys.CONTROL, ‘a’)) doesn’t work on Mac OS.
I used :

WebUI.doubleClick(obj_repository)
WebUI.sendKeys(obj_repository, Keys.chord(Keys.DELETE))

And it works for me

It shows Underlined below “keys.chord(Keys.DELETE)” hence my code is not running. What I am missing? Can you please help?

Either you are missing the import statement associated with the Keys reference or you need to be careful how you spell the Keys reference in respect of letter case (you have the k of Keys in lowercase–it needs to be in uppercase)

import org.openqa.selenium.Keys as Keys

 ..., Keys.chord(Keys.TAB)

Another way to collect all associated references is to use the CTRL + SHIFT + O (oh) combination. This method gets all necessary import references (and takes away those you don’t need).

1 Like

@grylion54 Import statement was missing, thanks a lot for help, Appreciate it