close the browser tab, opened by opn in node js

674 Views Asked by At

I'm using the opn package to open a url in my browser. I need to close that window after some time from the node service. How do I achieve that using opn?

I tried with node-horseman. I can't use that more than once, however. If I try, I get an issue in the second horseman like

Unhandled rejection HeadlessError: Phantom Process died  

I need to close the opened windows through the service. How do I solve this? Can anyone help me out?

And my horseman code is,

horseMan
    .open('http://localhost:4000/next?port=3000')
    .log('Checking the next course...')
    .close();  

Thanks in advance.

0

There are 0 best solutions below