Using Selenium how to delete single characters from a textbox using Selenium?

I have to delete the last 2 characters from text box.

Ex: ABCD to AB

2 Answers 2


If you are using Java, try this to delete one character:

  • Thanks a lot. But what this "\u0008" is? ASCII value of backspace is 0x08
    – smriti
    Commented Jun 24, 2011 at 12:31
  • 1
    "\u0008" is Unicode for the backspace character. The sendKeys method takes a CharacterSequence as input. "\u0008" is a CharacterSequence; 0x08 is an integer instead of a CharacterSequence. Moreover, you cannot use 0x notation to encode characters within a Java string.
    – user246
    Commented Jun 24, 2011 at 13:07

While using the ASCII valid (\u008) is valid, there are already defines for this which makes your code more readable, as such:


For a list of the key names, there's some official documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.