PhantomJS:在REPL中运行时,page.open()不响应 [英] PhantomJS: page.open() does not respond when running in REPL

查看:391
本文介绍了PhantomJS:在REPL中运行时,page.open()不响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过标准输入发送一些phantomJS来运行它,但是我打开的网页没有响应.

I'm trying to run some phantomJS by sending it in via Standard Input, but my webpage open does not respond.

这是我要执行的javascript:

Here is the javascript I'm trying to execute:

require('webpage').create().open('http://google.com', function() { console.log('done'); phantom.exit(); });

挺直的,对吧?

将其放在file.js中,并使用

Put that in a file.js, and use

phantomjs.exe file.js

它可以工作,但是可以通过REPL执行它

and it works, but execute it via REPL

phantomjs.exe
phantomjs> require('webpage').create().open('http://google.com', function() { console.log('done'); phantom.exit(); });

,它永远不会触发回调.侦听onResourceRequested表示请求与请求相同,但是onResourceReceived永远不会回来.

and it never hits the callback. Listening to onResourceRequested shows it is being requested the same, but onResourceReceived never comes back.

这是在Windows 7上运行的.Page.open为REPL工作需要做些特别的事情吗?

This is running on windows 7. Is there anything special I need to do for page.open to work for REPL?

我应该提到,我是从C#在一个实际上无法从文件执行的环境中运行此代码的

I should have mentioned, I'm running this from C# in an environment where executing from a file isn't really feasible

推荐答案

与我相同. 快速浏览git存储库后,似乎是一个已知问题: https://github.com/ariya/phantomjs/issues/10518

Same for me. After a quick look on git repository, it seems it's a known issue : https://github.com/ariya/phantomjs/issues/10518

这篇关于PhantomJS:在REPL中运行时,page.open()不响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆