Chrome extension not interacting with search bar on UpToDate.com properly

Pharmacist and programming newbie here. I’m trying to make a chrome extension operate on the website UpToDate.com to utilize the drug interaction checker. It takes a block of text input from a user (copy+pasted from a med list) and then splits it into individual words separating by spaces. It then enters each word into the drug interaction search bar and enters the ‘return’ key (have tried with clicking the add button instead).

The problem is that when I run the extension it finishes with only the final word in the text input entered into the search bar with none of the previous drugs being successfully added to the interaction checker.

Here is my current js code (added some delays to see if that fixed with no luck):

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    if (request.action === 'userInput') {
      const words = request.data; // Receive the list of words

      const searchInput = document.querySelector('.search-input');

      words.forEach(async (word, index) => {
        searchInput.value = word; // Set the input value

        searchInput.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));

        if (index < words.length - 1) { 
          await new Promise(resolve => setTimeout(resolve, 1500)); // Wait 1.5 seconds
        }
      });
    }
  });

  async function waitForElementToBeClickable(element) {
    return new Promise(resolve => {
      const interval = setInterval(() => {
        if (element && element.disabled === false && element.style.display !== 'none') {
          clearInterval(interval);
          resolve();
        }
      }, 100); 
    });
  }

Any help is much appreciated! Looking to improve time spent on patient care and spend less time with clerical work during reviews/audits