There are multiple browser automation frameworks whose interface is either in JavaScript or have JS bindings. Puppeteer has been mentioned. Playwright is very similar, also good and is designed more for what you are asking about. Selenium is the most common.
But including desktop applications in that… bridging the gap between them…that’s not very common. If the desktop wallet application is an Electron app (not unlikely), then that is also effectively a browser and should expose the same API, so a browser automation framework in theory should be able to handle it. If it isn’t, there are desktop automation frameworks for testing, and one or two of those may have JS bindings. It’s not really a massive issue if they don’t have bindings, just means you need to learn the commands required. If you’re on a Mac, then it comes with its own automation framework (on Windows I’ve got no idea, but I assume not) so you can write scripts using the language that framework uses, then execute that script from the Node script via spawn or exec. How you pass the data, not sure – easiest I guess is just write to a text file with the browser scripting, then read from that text file when the desktop automation kicks in