我在PhantomJS的一些文档中看到它可以访问全局"document"对象,但我不知道是否也可以访问全局"window"对象。
所以我的问题是,是否有一种特殊的方式,或者我可以直接调用窗口对象后,我使用PhantomJS初始化页面?
在终端上运行phantomjs
会给你一个可以玩的交互式会话。
如果你运行console.log(window)
,你会看到你可以访问window
对象。
phantomjs> console.log(window);
[object DOMWindow]