PhantomJS: page.open() does not respond when running in REPL

十年热恋 提交于 2019-12-01 05:04:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!