IOSElement.setValue() is not clearing the existing data from the text box

IOSElement.setValue() is not clearing the existing data from the text box instead placing the cursor in middle of the text and entering requested data.

To avoid that I tried to clear the text box using IOSElement.clear(). But this method placing the cursor in middle of the text in text box and clearing left side of the data (like backspace) only and right side data still exist.

IOSElement element = (IOSElement)driver.findElement(resolvedLocator);
element.clear();
element.setValue(text);

Below is my Environment:
Framework: XCUITest
Xcode: 8.3.3
Appium : v1.7.2-beta2
iPad iOS version: 10.3.3
io.appium.java-client api version: 5.0.4

Thanks,
Ramesh Sriram

Try clicking in textfield first then do clear.
element.click();
element.clear();

Other option would be-
If there is any cross in textfield which is common practice in iOS, press it to clear text

Thanks for your response. I tried element.click also, but I did not find any change.

element.click() : placing the cursor in middle of the text (if is there any text exist in the textbox).
element.clear() : placing the cursor in the middle of the text (if is there any text exist in the textbox) and then removing only the characters exist in left side (behaving link backspace) and right side characters still exist.

ex: Assume 100 is existing in the text box and I want to remove 100 and type 55 in the text box.
For this I tried below 2 ways and got same result.

1.
element.click();
element.clear();
element.setValue(“55”);

OR

2.
element.clear();
element.setValue(“55”);

Result: Cursor placing in middle(next to 1 and before 00) and removing only 1 then typing 55 and finally it results 5500 instead of 55