- PhantomJS Tutorial
- PhantomJS - Home
- PhantomJS - Overview
- PhantomJS - Environment Setup
- PhantomJS - Object
- PhantomJS - Methods
- WebPage Module
- PhantomJS - Properties
- PhantomJS - Methods
- PhantomJS - Events/Callbacks
- PhantomJS - Child Process Module
- File System Module
- PhantomJS - Properties
- PhantomJS - Methods
- System Module
- PhantomJS - Properties
- Web Server Module
- PhantomJS - Properties
- PhantomJS - Methods
- Miscellaneous
- Command Line Interface
- PhantomJS - Screen Capture
- PhantomJS - Page Automation
- PhantomJS - Network Monitoring
- PhantomJS - Testing
- PhantomJS - REPL
- PhantomJS - Examples
- PhantomJS Useful Resources
- PhantomJS - Quick Guide
- PhantomJS - Useful Resources
- PhantomJS - Discussion
PhantomJS - pagesWindowName Property
The pagesWindowName property returns the names of the windows that are opened using window.open.
Syntax
Its syntax is as follows −
var wpage = require('webpage').create(); wpage.pagesWindowName;
Example
Let us take an example to understand the use of pagesWindowName property.
var wpage = require('webpage').create(); wpage.open('http://localhost/tasks/ptitle.html', function (status) { console.log(wpage. pagesWindowName); phantom.exit(); });
ptitle.html
<html> <head> <title>Testing PhantomJs</title> </head> <body> <script type = "text/javascript"> window.onload = function() { window.open("http://localhost/tasks/a.html","page1"); window.open("http://localhost/tasks/content.html", "page2"); } </script> <h1>This is a test page</h1> </body> </html>
It will generate the following output.
page1, page2
The output gives an array of page names opened using the window.open command. If the window is closed, it is not considered.
phantomjs_webpage_module_properties.htm
Advertisements