问题
I'm trying to run some phantomJS by sending it in via Standard Input, but my webpage open does not respond.
Here is the javascript I'm trying to execute:
require('webpage').create().open('http://google.com', function() { console.log('done'); phantom.exit(); });
Pretty straight forward, right?
Put that in a file.js, and use
phantomjs.exe file.js
and it works, but execute it via REPL
phantomjs.exe
phantomjs> require('webpage').create().open('http://google.com', function() { console.log('done'); phantom.exit(); });
and it never hits the callback. Listening to onResourceRequested shows it is being requested the same, but onResourceReceived never comes back.
This is running on windows 7. Is there anything special I need to do for page.open to work for REPL?
Edit: I should have mentioned, I'm running this from C# in an environment where executing from a file isn't really feasible
回答1:
Same for me. After a quick look on git repository, it seems it's a known issue : https://github.com/ariya/phantomjs/issues/10518
来源:https://stackoverflow.com/questions/15425406/phantomjs-page-open-does-not-respond-when-running-in-repl