Hello stackoverflow community!
Problem
I have this piece of HTML code:
<div class="ds-u-clearfix ds-l-col--auto">
:: before
<label class="ds-c-label ds-u-font-weight--normal ds-u-margin-top--1" for="textfield_13" id="textfield_label_14">
<span class="">Day</span>
</label>
<input class="ds-c-field ds-c-field--day ds-c-field--error" id="textfield_13" type="number" max="31" min="1" name="day" aria-describedby="datefield_label_10" value="01">
:: after
</div>
I'm working on test automation using protractor and I need to clear an input field that has a value already. Protractor's .clear() doesn't work (literally has no effect). So I though I could inject a script to the devtools' console to change the value. But when I do that (eg $elem.value = ""
) it looks like it's clearing the input, but if I start typing another value, the previous one appears again
Question
How do I clear the value of the input permanently?
What I tried so far
$elem.value = "";
$elem.value = null;
$elem.defaultValue = "";
$elem.setAttribute ("value", "");
// and many more
Again, whenever I do any of this^^ it looks like the input is cleared, but then the value comes back if I start typing
Thanks for reading to the end :)