PhantomJS中的Window对象 [英] Window object in PhantomJS

查看:218
本文介绍了PhantomJS中的Window对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PhantomJS的一些文档中看到它可以访问全局文档"对象,但是我不知道是否也可以访问全局窗口"对象.

I have seen in some documentation of PhantomJS that it can access the global "document" object but I don't know if it is also possible to access the global "window" object.

所以我的问题是,有没有一种特殊的方法,或者我可以在使用PhantomJS初始化页面后直接调用window对象?

So my question is, is there a special way or I can just call the window object directly after I initialize a page using PhantomJS?

推荐答案

从终端运行phantomjs可为您提供一个可以玩的交互式会话.

Running phantomjs from a terminal gives you an interactive session you can play around with.

如果您随后运行console.log(window),则会看到您有权访问window对象.

If you then run console.log(window) you'll see you have access to the window object.

phantomjs> console.log(window);
[object DOMWindow]

这篇关于PhantomJS中的Window对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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