Enter on text field not working in webpages

I am trying to automate a process on webpages. The element is

<input aria-expanded="false" aria-owns="search-dropdown-results" data-accessibility-id="header-search-input-field" data-anchor-id="HeaderSearchInputField" data-lpignore="true" type="text" autocomplete="off" placeholder="Search stores, dishes, products" inputmode="search" id="FieldWrapper-0" aria-describedby="search-dropdown-results" class="Input__InputContent-sc-1o75rg4-3 idveBz" value="">

First, I entered a text in the field and then I want to press Enter. But the Enter part is not working. Please help.

var inputElement = document.getElementById('FieldWrapper-0');
inputElement.value = "TEXT";
inputElement.dispatchEvent(new Event('input', { bubbles: true }));`
inputElement.dispatchEvent(new KeyboardEvent('keydown', { 'key': 'Enter' }));

Is it wrapped in a form tag where you could trigger a submit event?
Otherwise try triggering a change event to see if that makes things fire.

1 Like