Webpage Module Events/Callbacks
The callbacks available with the webpage module are described in the following table.
|S.No||Callbacks & Description|
This callback is called when there is an alert on the page; the callback takes a string and does not return anything.
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.
This is called when the window is closed either by using the page.close() method or the window.close() method.
This callback is called when there is a confirmed message called with ok /cancel from the page.
This callback is used when there are console messages used in the webpage. The onConsoleMessage method takes 3 arguments.
This is used for upload file the callback is called when user want to upload a file.
This callback is invoked when the page is called before loading.
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.
This callback is invoked when the page starts loading.
This callback tells when the navigation event is taking place.
This callback is invoked when a new child window is opened by the page.
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.
This callback is called when the webpage is not able to upload the file.
This callback is called when the resource requested by the page is received.
This function is invoked when page requests a resource.
This callback is called when the requested resource times out, when settings.resourceTimeout is used.
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.