How to clear drop-down box default text


#1

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


#2

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


#3

Hi Kingz,

Try this:

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

Just make the parameter blank.

Hope that helps. . . :slight_smile:


#4

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


#5

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


#6

Try SendKeys

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


#7

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


#8

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.