PhantomJS,但不是没有头吗? [英] PhantomJS, but not headless?

查看:82
本文介绍了PhantomJS,但不是没有头吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以实时查看正在渲染的PhantomJS(或类似内容)?

Is there a way to get a realtime view of what PhantomJS (or similar) is rendering?

我想在与目标页面进行交互(或至少看到其截屏)的同时开发自动化脚本.

I would like to develop my automation script while interacting with (or at least seeing a screencap of) the page it's targeted to.

推荐答案

不,没有这样的东西. SlimerJS 具有与PhantomJS相同的API,但运行Gecko引擎.您可以直接查看正在发生的事情,并使用 xvfb-运行.

No, there is no such thing. SlimerJS has the same API as PhantomJS, but runs the Gecko engine. You can see directly what is going on and run it headlessly with xvfb-run.

您将无法与其进行交互.在长时间的测试中,您可能希望使用屏幕抓取器来记录交互的视频,如果您没有在测试用例中发现问题,则不想再次运行测试套件.

You will not be able to interact with it. You may want to use a screengrabber to record a video of the interaction when the tests are long and you don't want to run the test suite again if you didn't catch the problem in the test case.

调试PhantomJS脚本的明显方法是使用page.render()渲染许多屏幕截图,并使用

The obvious way to debug PhantomJS scripts is to render many screenshots using page.render() and logging some objects to the console with

console.log(JSON.stringify(yourObj, undefined, 4));

格式不错.

这篇关于PhantomJS,但不是没有头吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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