How to catch new window opend by window.open(url, _blank) in PhantomJS?
I'd like to check with PhantomJS whether my script correctly opens a new window/tab on click. The open is triggerd by a js event listener and opened through window.open(url, "_blank") . How can I listen for the new window with PhantomJS? There seem to be three ways to do this: onPageCreated CasperJS solves this by using page.onPageCreated . So when window.open is called in the page, a new page is created and page.onPageCreated is triggered with the newly created page. page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); phantom.exit();