I need to open multiple windows/tabs of firefox using Node. Now, when i use a spawn() call:
var spawn = require('child_process').spawn;
ff = spawn('firefox', ['www.stackoverflow.com', '-new-tab']);
If i use two (or more) calls right after the other, firefox claims there's a page that is not responding, and will not open another window.
That can be solved using some implementation of sleep() - which is bad practice because there's no way of knowing the actual loading time.
This is why i'm looking for an event that is fired when a firefox window/tab is considered "not busy"-
I have searched in the ChildProcess class documentation and didn't see any event of such.
Since the page i'm loading connects to a Node http server, and uses socket.io, i was thinking of a workaround: when the page finishes loading, i'll use socket.io to notify the server that the window is ready, and then be able to open a new window- but that just seems wrong.