Assuming we are talking about a text field (i.e. you are not trying to clear / enter the div tag), the .set() and .value= methods automatically delete the text field before entering the value.
So one of the following will work:
browser.text_field(:id, 'yourid').set('hi') browser.text_field(:id, 'yourid').value = 'hi'
Note that it is generally recommended to use .set , since .value= does not fire events.
source share