Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.
I think I've found a solution. Instead of sending individual keystrokes, I've found I can use the following javascript to enter a value into an input element:
There is a potential problem with this because document.execCommand() is deprecated, although it still works, and if it doesn't still work in the future I'll have to try something else.