How to clear drop-down box default text

how to clear these text? Actually, that xpath is //div[@id=‘xf_staffcode’]/input

I try to use the keyword clear text , but it’s can’t work

Hi Kingz,

Try this:

WebUI.setText(findTestObject("Your_TestObject"), "")

Just make the parameter blank.

Hope that helps. . . :slight_smile:

I tried this method just now but it couldn’t work

When I use keyword Clear Text and setText , the result is as following
Default text is ADMIN and then 9999 is set , so you can see that keyword Clear Text can not work

Try SendKeys

If that doesn’t work, post the relevant HTML and I’ll clear it with JavaScript.

Thanks for your reply ,I have solved this problem with combining keyword double click with send keys [delete]


Hi KingZ,

There should be other ways you can use to do this. Try it out manually first then apply the keys you typed using SendKeys. For example: You can do Control+Shift+Home or Control+Shift+End to select your text then pressing Backspace Key, is one of them.