You can try handling the textbox on your site/application in a few different ways.
- Click on the textbox:
Then use the ‘Send Keys’ action (note, this is not an element action), to send the BACK_SPACE key as many times as you need to delete the contents of the text box:
It’s important to run the ‘Send Keys’ action right after the click, so the text box will be in focus.
You can download an example test from here by following the link:
This snippet will locate the text box based on it’s XPATH, and clear the text box.
document.evaluate( 'YOUR_XPATH' ,document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.value = "";
You can get the test from here:
If you happen to be on mobile, you can use the ‘Execute Android Shell Command’ action after clicking/tapping on the text box to clear it’s contents with the following command:
adb shell input keyevent KEYCODE_DEL
And on iOS you can click on the text box to make the keyboard appear and record clicks/taps on the delete button.