- PhantomJS - Methods
- PhantomJS - Object
- PhantomJS - Environment Setup
- PhantomJS - Overview
- PhantomJS - Home
WebPage Module
- PhantomJS - Child Process Module
- PhantomJS - Events/Callbacks
- PhantomJS - Methods
- PhantomJS - Properties
File System Module
System Module
Web Server Module
Miscellaneous
- PhantomJS - Examples
- PhantomJS - REPL
- PhantomJS - Testing
- PhantomJS - Network Monitoring
- PhantomJS - Page Automation
- PhantomJS - Screen Capture
- Command Line Interface
PhantomJS Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
PhantomJS - Webpage Module Properties
PhantomJS provides quite a lot of properties and methods to help us to interact with the contents inside a webpage.
The require("webpage").create() command creates a webpage object. We will use this object to manipulate the webpage with the help of properties and methods psted below.
var wpage = require("webpage").create();
The following table has the pst of all the webpage properties that we are going to discuss.
S.No | Properties & Description |
---|---|
1 | This property returns true if there is previous page in the navigation history; if not, false. |
2 | This property returns true if there is next page in the navigation history; if not, false. |
3 | cppRect is an object with values top, left, width and height and used to take the image capture of the webpage when used by the render() method. |
4 | This property contains the contents of webpage. |
5 | With cookies, you can set /get the cookies available on the URL. It will also give you the cookies available on the URL and the new cookies set on the page. |
6 | customHeaders specifies additional HTTP request headers that will be send to server for every request issued by the page. |
7 | It gives long pst of events i.e. modifier, keys details. |
8 | Returns the name of the currently focused frame. |
9 | This property gives the content of the frame which is active. |
10 | Returns the name of the currently focused frame. |
11 | This property also gives the contents of the current active frame but only contents without any html tags. |
12 | Gives the title of the active frame. |
13 | This property will give the url of the currently focused frame. |
14 | Gives the count of the frames present on the page. |
15 | Gives array of frame names. |
16 | This property has the path, which is used by page.inectJs method. |
17 | This property defines whether navigation of the page is allowed or not. If true it will be on current page url and cpcking on page to go to next page will not be allowed. |
18 | This property gives the path where the data is stored using window.localStorage.The path can be changed using --local-storage-path from command pne. |
19 | This property defines the maximum amount of data you can store in window.localStorage.The value is 5242880 bytes which is 5MB.This value can overwritten at command pne using the following command --localstorage-quota = size over here. |
20 | ownsPages returns true or false if the page opened by the webpage is a child of the webpage. |
21 | PagesWindowName will give the names of the windows open using window.open |
22 | The pages property will you give array of pages opened in a page using window.open. If the page is closed in url you referring the page will not be considered. |
23 | This property gives the size ie dimensions of the webpage when needs to be used to convert the webpage in a pdf format.paperSize contains the dimensions required in an object. |
24 | This property also gives the contents of the current active frame but only contents without any html tags. |
25 | This contains object indicating the scroll position. It gives left and top. |
26 | This property will give the settings of the webpage when page.open method is used. Once the page is loaded the changes in settings properties will not create any impact. |
27 | This property will give you the title of the page you are reading. |
28 | This property will give the page url. |
29 | This property allows to change the size of the window display. It contains width and height, which you can read or change it as per the needs. |
30 | Gives the name of the window. |
31 | This property specifies the zoom factor for render and renderBase64 methods. It helps to zoom a page and take a screen capture if required. |