source: other-projects/FileTransfer-WebSocketPair/Themes/themebuilder/bin/phantomjs-1.9.2-windows/examples/injectme.coffee@ 31525

Last change on this file since 31525 was 31525, checked in by ak19, 7 years ago

Nathan provided more stuff: Themes folder contains Sencha's Themebuilder which generates GXT Themes. It includes the .theme and generated .jar files for the project theme.

File size: 739 bytes
Line 
1# Use 'page.injectJs()' to load the script itself in the Page context
2
3if phantom?
4 page = require('webpage').create()
5
6 # Route "console.log()" calls from within the Page context to the main
7 # Phantom context (i.e. current "this")
8 page.onConsoleMessage = (msg) -> console.log(msg)
9
10 page.onAlert = (msg) -> console.log(msg)
11
12 console.log "* Script running in the Phantom context."
13 console.log "* Script will 'inject' itself in a page..."
14 page.open "about:blank", (status) ->
15 if status is "success"
16 if page.injectJs("injectme.coffee")
17 console.log "... done injecting itself!"
18 else
19 console.log "... fail! Check the $PWD?!"
20 phantom.exit()
21else
22 alert "* Script running in the Page context."
23
Note: See TracBrowser for help on using the repository browser.