- 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
Webpage Module Events/Callbacks
The callbacks available with the webpage module are described in the following table.
S.No | Callbacks & Description |
---|---|
1 | This callback is called when there is an alert on the page; the callback takes a string and does not return anything. |
2 | OnCallback is used to pass values from webpage to webpage object and it is done using the window.callPhantom() method, which internally invokes the onCallback function. |
3 | This is called when the window is closed either by using the page.close() method or the window.close() method. |
4 | This callback is called when there is a confirmed message called with ok /cancel from the page. |
5 | This callback is used when there are console messages used in the webpage. The onConsoleMessage method takes 3 arguments. |
6 | It is called when there is JavaScript error. The arguments for onError are msg and stack trace, which is an array. |
7 | This is used for upload file the callback is called when user want to upload a file. |
8 | This callback is invoked when the page is called before loading. |
9 | This function is called when the page opened is fully loaded. It has one argument, which tells when loading was a success or a failure. |
10 | This callback is invoked when the page starts loading. |
11 | This callback tells when the navigation event is taking place. |
12 | This callback is invoked when a new child window is opened by the page. |
13 | This callback is called when a prompt is called by the web page. It takes 2 arguments, message and the answer. The return value is a string. |
14 | This callback is called when the webpage is not able to upload the file. |
15 | This callback is called when the resource requested by the page is received. |
16 | This function is invoked when page requests a resource. |
17 | This callback is called when the requested resource times out, when settings.resourceTimeout is used. |
18 | This is called when the URL changes from the current one using navigation. It has one argument to the call back, which is a new URL targetUrl string. |