function watchForElement (selector) {
  return new Promise(resolve => {
    const element = document.querySelector(selector)
    if (element) {
      console.log(`[FastForward] Element found: ${element} | Selector: ${selector}`)
      resolve(element)
      return
    }

    const observer = new MutationObserver(() => {
      Array.from(document.querySelectorAll(selector)).forEach(el => {
        console.log(`[FastForward] Element found: ${el} | Selector: ${selector}`)
        resolve(el)
        observer.disconnect()
      })
    })

    observer.observe(document.documentElement, {
      attributes: true,
      childList: true,
      subtree: true
    })
  })
}
Watch for an element to appear on the page. This is used to prevent the script from running if the element doesn't exist. Improved version of waitForElement.
@param {string} e - The element to watch.
@returns {Promise<any>} A promise that resolves with the element.