Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Need to Delete Current Text and Enter New Text in Web Input Field

Speedy993
Speedy993 Posts: 72

I am using SOATest 2021 and am having a problem with a date input field. As a by-product of the framework we are using, trying to replace the default date in the input field results in a long string of 2 dates instead of the new date. Basically what I need is to Select All followed by a delete of the selected date and then Typing in the new date.

Is there a way to do this in SOATest? I have not been able to find something that works in the documentation I have looked at and my experimenting has not work either.

I would appreciate any suggestions anyone has. I have found these forums to be very helpful.

Comments

  • tony
    tony Posts: 33 ✭✭

    Typing into a text input should automatically clear the input first before entering new text, so it's not clear why you are seeing different behavior.

    If you are setting the value in the calendar by selecting a date in a UI rather than typing to the input field, and that is causing the duplicate values, you can try either:

    • Use a Type action to type directly into the field rather than using the date-picker UI
    • Use a Type action with an empty Text Input value. This should clear the field even though nothing new is entered.

    You can also try modifying the input field using JavaScript using an Execute JavaScript action. For example, the following JavaScript will clear an input field:

    function clear(element) {
        element.value = "";
    }
    

    You will need to configure the Execute JavaScript action's Element Locator with the proper locator for the text input.