phantomjs.rb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG +11 -0
- data/MIT-LICENSE +21 -0
- data/lib/phantomjs.rb +4 -2
- data/lib/phantomjs/version.rb +1 -1
- data/phantomjs.rb.gemspec +5 -1
- metadata +20 -186
- data/vendor/phantomjs-1.4.1_OSX/ChangeLog +0 -145
- data/vendor/phantomjs-1.4.1_OSX/LICENSE.BSD +0 -22
- data/vendor/phantomjs-1.4.1_OSX/README.md +0 -33
- data/vendor/phantomjs-1.4.1_OSX/bin/Info.plist +0 -12
- data/vendor/phantomjs-1.4.1_OSX/bin/phantomjs +0 -0
- data/vendor/phantomjs-1.4.1_OSX/examples/arguments.coffee +0 -6
- data/vendor/phantomjs-1.4.1_OSX/examples/arguments.js +0 -8
- data/vendor/phantomjs-1.4.1_OSX/examples/colorwheel.coffee +0 -46
- data/vendor/phantomjs-1.4.1_OSX/examples/colorwheel.js +0 -51
- data/vendor/phantomjs-1.4.1_OSX/examples/countdown.coffee +0 -8
- data/vendor/phantomjs-1.4.1_OSX/examples/countdown.js +0 -9
- data/vendor/phantomjs-1.4.1_OSX/examples/detectsniff.coffee +0 -40
- data/vendor/phantomjs-1.4.1_OSX/examples/detectsniff.js +0 -57
- data/vendor/phantomjs-1.4.1_OSX/examples/direction.coffee +0 -29
- data/vendor/phantomjs-1.4.1_OSX/examples/direction.js +0 -34
- data/vendor/phantomjs-1.4.1_OSX/examples/echoToFile.coffee +0 -19
- data/vendor/phantomjs-1.4.1_OSX/examples/echoToFile.js +0 -22
- data/vendor/phantomjs-1.4.1_OSX/examples/features.js +0 -30
- data/vendor/phantomjs-1.4.1_OSX/examples/fibo.coffee +0 -8
- data/vendor/phantomjs-1.4.1_OSX/examples/fibo.js +0 -9
- data/vendor/phantomjs-1.4.1_OSX/examples/follow.coffee +0 -54
- data/vendor/phantomjs-1.4.1_OSX/examples/follow.js +0 -59
- data/vendor/phantomjs-1.4.1_OSX/examples/hello.coffee +0 -2
- data/vendor/phantomjs-1.4.1_OSX/examples/hello.js +0 -2
- data/vendor/phantomjs-1.4.1_OSX/examples/imagebin.coffee +0 -19
- data/vendor/phantomjs-1.4.1_OSX/examples/imagebin.js +0 -22
- data/vendor/phantomjs-1.4.1_OSX/examples/injectme.coffee +0 -23
- data/vendor/phantomjs-1.4.1_OSX/examples/injectme.js +0 -25
- data/vendor/phantomjs-1.4.1_OSX/examples/ipgeocode.coffee +0 -13
- data/vendor/phantomjs-1.4.1_OSX/examples/ipgeocode.js +0 -14
- data/vendor/phantomjs-1.4.1_OSX/examples/loadspeed.coffee +0 -17
- data/vendor/phantomjs-1.4.1_OSX/examples/loadspeed.js +0 -22
- data/vendor/phantomjs-1.4.1_OSX/examples/modernizr.js +0 -1116
- data/vendor/phantomjs-1.4.1_OSX/examples/movies.coffee +0 -13
- data/vendor/phantomjs-1.4.1_OSX/examples/movies.js +0 -14
- data/vendor/phantomjs-1.4.1_OSX/examples/netlog.coffee +0 -17
- data/vendor/phantomjs-1.4.1_OSX/examples/netlog.js +0 -23
- data/vendor/phantomjs-1.4.1_OSX/examples/netsniff.coffee +0 -109
- data/vendor/phantomjs-1.4.1_OSX/examples/netsniff.js +0 -131
- data/vendor/phantomjs-1.4.1_OSX/examples/outputEncoding.coffee +0 -12
- data/vendor/phantomjs-1.4.1_OSX/examples/outputEncoding.js +0 -16
- data/vendor/phantomjs-1.4.1_OSX/examples/phantomwebintro.coffee +0 -13
- data/vendor/phantomjs-1.4.1_OSX/examples/phantomwebintro.js +0 -19
- data/vendor/phantomjs-1.4.1_OSX/examples/pizza.coffee +0 -18
- data/vendor/phantomjs-1.4.1_OSX/examples/pizza.js +0 -20
- data/vendor/phantomjs-1.4.1_OSX/examples/post.coffee +0 -12
- data/vendor/phantomjs-1.4.1_OSX/examples/post.js +0 -14
- data/vendor/phantomjs-1.4.1_OSX/examples/rasterize.coffee +0 -22
- data/vendor/phantomjs-1.4.1_OSX/examples/rasterize.js +0 -27
- data/vendor/phantomjs-1.4.1_OSX/examples/render_multi_url.coffee +0 -48
- data/vendor/phantomjs-1.4.1_OSX/examples/render_multi_url.js +0 -60
- data/vendor/phantomjs-1.4.1_OSX/examples/run-jasmine.coffee +0 -59
- data/vendor/phantomjs-1.4.1_OSX/examples/run-jasmine.js +0 -77
- data/vendor/phantomjs-1.4.1_OSX/examples/run-qunit.coffee +0 -62
- data/vendor/phantomjs-1.4.1_OSX/examples/run-qunit.js +0 -74
- data/vendor/phantomjs-1.4.1_OSX/examples/scandir.coffee +0 -15
- data/vendor/phantomjs-1.4.1_OSX/examples/scandir.js +0 -21
- data/vendor/phantomjs-1.4.1_OSX/examples/seasonfood.coffee +0 -17
- data/vendor/phantomjs-1.4.1_OSX/examples/seasonfood.js +0 -19
- data/vendor/phantomjs-1.4.1_OSX/examples/simpleserver.coffee +0 -35
- data/vendor/phantomjs-1.4.1_OSX/examples/simpleserver.js +0 -40
- data/vendor/phantomjs-1.4.1_OSX/examples/sleepsort.coffee +0 -17
- data/vendor/phantomjs-1.4.1_OSX/examples/sleepsort.js +0 -24
- data/vendor/phantomjs-1.4.1_OSX/examples/technews.coffee +0 -17
- data/vendor/phantomjs-1.4.1_OSX/examples/technews.js +0 -16
- data/vendor/phantomjs-1.4.1_OSX/examples/tweets.coffee +0 -30
- data/vendor/phantomjs-1.4.1_OSX/examples/tweets.js +0 -36
- data/vendor/phantomjs-1.4.1_OSX/examples/unrandomize.coffee +0 -18
- data/vendor/phantomjs-1.4.1_OSX/examples/unrandomize.js +0 -24
- data/vendor/phantomjs-1.4.1_OSX/examples/useragent.coffee +0 -11
- data/vendor/phantomjs-1.4.1_OSX/examples/useragent.js +0 -14
- data/vendor/phantomjs-1.4.1_OSX/examples/version.coffee +0 -5
- data/vendor/phantomjs-1.4.1_OSX/examples/version.js +0 -5
- data/vendor/phantomjs-1.4.1_OSX/examples/waitfor.coffee +0 -48
- data/vendor/phantomjs-1.4.1_OSX/examples/waitfor.js +0 -57
- data/vendor/phantomjs-1.4.1_OSX/examples/weather.coffee +0 -48
- data/vendor/phantomjs-1.4.1_OSX/examples/weather.js +0 -57
- data/vendor/phantomjs-1.4.1_OSX/lib/jquery.js +0 -8374
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/ChangeLog +0 -177
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/LICENSE.BSD +0 -22
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/README.md +0 -33
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/bin/Info.plist +0 -12
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/bin/phantomjs +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/arguments.coffee +0 -7
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/arguments.js +0 -9
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/colorwheel.coffee +0 -46
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/colorwheel.js +0 -51
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/countdown.coffee +0 -8
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/countdown.js +0 -9
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/detectsniff.coffee +0 -41
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/detectsniff.js +0 -58
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/direction.coffee +0 -30
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/direction.js +0 -35
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/echoToFile.coffee +0 -20
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/echoToFile.js +0 -24
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/features.js +0 -30
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/fibo.coffee +0 -8
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/fibo.js +0 -9
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/follow.coffee +0 -29
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/follow.js +0 -34
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/hello.coffee +0 -2
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/hello.js +0 -2
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/imagebin.coffee +0 -20
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/imagebin.js +0 -23
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/injectme.coffee +0 -23
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/injectme.js +0 -25
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/ipgeocode.coffee +0 -13
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/ipgeocode.js +0 -14
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/loadspeed.coffee +0 -18
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/loadspeed.js +0 -23
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/modernizr.js +0 -1116
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/movies.coffee +0 -13
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/movies.js +0 -14
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/netlog.coffee +0 -18
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/netlog.js +0 -25
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/netsniff.coffee +0 -110
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/netsniff.js +0 -132
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/outputEncoding.coffee +0 -12
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/outputEncoding.js +0 -16
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/phantomwebintro.coffee +0 -13
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/phantomwebintro.js +0 -19
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/pizza.coffee +0 -18
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/pizza.js +0 -20
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/post.coffee +0 -12
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/post.js +0 -14
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/postserver.js +0 -34
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/printenv.js +0 -10
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/printmargins.js +0 -35
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/rasterize.coffee +0 -23
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/rasterize.js +0 -28
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/render_multi_url.coffee +0 -50
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/render_multi_url.js +0 -62
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/run-jasmine.coffee +0 -61
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/run-jasmine.js +0 -79
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/run-qunit.coffee +0 -64
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/run-qunit.js +0 -76
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/scandir.coffee +0 -16
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/scandir.js +0 -22
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/seasonfood.coffee +0 -17
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/seasonfood.js +0 -19
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/server.js +0 -43
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/serverkeepalive.js +0 -34
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/simpleserver.coffee +0 -38
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/simpleserver.js +0 -42
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/sleepsort.coffee +0 -20
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/sleepsort.js +0 -25
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/technews.coffee +0 -17
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/technews.js +0 -16
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/tweets.coffee +0 -31
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/tweets.js +0 -37
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/unrandomize.coffee +0 -18
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/unrandomize.js +0 -24
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/useragent.coffee +0 -11
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/useragent.js +0 -14
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/version.coffee +0 -5
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/version.js +0 -5
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/waitfor.coffee +0 -48
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/waitfor.js +0 -57
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/weather.coffee +0 -49
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/weather.js +0 -58
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtCore.la +0 -28
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtCore.prl +0 -7
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtCore.so +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtCore.so.4 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtCore.so.4.8 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtCore.so.4.8.0 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtGui.la +0 -28
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtGui.prl +0 -7
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtGui.so +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtGui.so.4 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtGui.so.4.8 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtGui.so.4.8.0 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtNetwork.la +0 -28
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtNetwork.prl +0 -7
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtNetwork.so +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtNetwork.so.4 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtNetwork.so.4.8 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtNetwork.so.4.8.0 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtWebKit.la +0 -28
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtWebKit.prl +0 -6
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtWebKit.so +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtWebKit.so.4 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtWebKit.so.4.9 +0 -0
- data/vendor/phantomjs-1.5.0-liunx-x86-dynamic/lib/libQtWebKit.so.4.9.0 +0 -0
@@ -1,18 +0,0 @@
|
|
1
|
-
# Modify global object at the page initialization.
|
2
|
-
# In this example, effectively Math.random() always returns 0.42.
|
3
|
-
|
4
|
-
page = require('webpage').create()
|
5
|
-
page.onInitialized = ->
|
6
|
-
page.evaluate ->
|
7
|
-
Math.random = ->
|
8
|
-
42 / 100
|
9
|
-
|
10
|
-
page.open "http://ariya.github.com/js/random/", (status) ->
|
11
|
-
if status != "success"
|
12
|
-
console.log "Network error."
|
13
|
-
else
|
14
|
-
console.log page.evaluate(->
|
15
|
-
document.getElementById("numbers").textContent
|
16
|
-
)
|
17
|
-
phantom.exit()
|
18
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
// Modify global object at the page initialization.
|
2
|
-
// In this example, effectively Math.random() always returns 0.42.
|
3
|
-
|
4
|
-
var page = require('webpage').create();
|
5
|
-
|
6
|
-
page.onInitialized = function () {
|
7
|
-
page.evaluate(function () {
|
8
|
-
Math.random = function() {
|
9
|
-
return 42 / 100;
|
10
|
-
};
|
11
|
-
});
|
12
|
-
};
|
13
|
-
|
14
|
-
page.open('http://ariya.github.com/js/random/', function (status) {
|
15
|
-
var result;
|
16
|
-
if (status !== 'success') {
|
17
|
-
console.log('Network error.');
|
18
|
-
} else {
|
19
|
-
console.log(page.evaluate(function () {
|
20
|
-
return document.getElementById('numbers').textContent;
|
21
|
-
}));
|
22
|
-
}
|
23
|
-
phantom.exit();
|
24
|
-
});
|
@@ -1,11 +0,0 @@
|
|
1
|
-
page = require('webpage').create()
|
2
|
-
|
3
|
-
console.log 'The default user agent is ' + page.settings.userAgent
|
4
|
-
|
5
|
-
page.settings.userAgent = 'SpecialAgent'
|
6
|
-
page.open 'http://www.httpuseragent.org', (status) ->
|
7
|
-
if status isnt 'success'
|
8
|
-
console.log 'Unable to access network'
|
9
|
-
else
|
10
|
-
console.log page.evaluate -> document.getElementById('myagent').innerText
|
11
|
-
phantom.exit()
|
@@ -1,14 +0,0 @@
|
|
1
|
-
var page = require('webpage').create();
|
2
|
-
console.log('The default user agent is ' + page.settings.userAgent);
|
3
|
-
page.settings.userAgent = 'SpecialAgent';
|
4
|
-
page.open('http://www.httpuseragent.org', function (status) {
|
5
|
-
if (status !== 'success') {
|
6
|
-
console.log('Unable to access network');
|
7
|
-
} else {
|
8
|
-
var ua = page.evaluate(function () {
|
9
|
-
return document.getElementById('myagent').innerText;
|
10
|
-
});
|
11
|
-
console.log(ua);
|
12
|
-
}
|
13
|
-
phantom.exit();
|
14
|
-
});
|
@@ -1,48 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Wait until the test condition is true or a timeout occurs. Useful for waiting
|
3
|
-
# on a server response or for a ui change (fadeIn, etc.) to occur.
|
4
|
-
#
|
5
|
-
# @param testFx javascript condition that evaluates to a boolean,
|
6
|
-
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
|
7
|
-
# as a callback function.
|
8
|
-
# @param onReady what to do when testFx condition is fulfilled,
|
9
|
-
# it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
|
10
|
-
# as a callback function.
|
11
|
-
# @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
|
12
|
-
##
|
13
|
-
waitFor = (testFx, onReady, timeOutMillis=3000) ->
|
14
|
-
start = new Date().getTime()
|
15
|
-
condition = false
|
16
|
-
f = ->
|
17
|
-
if (new Date().getTime() - start < timeOutMillis) and not condition
|
18
|
-
# If not time-out yet and condition not yet fulfilled
|
19
|
-
condition = (if typeof testFx is 'string' then eval testFx else testFx()) #< defensive code
|
20
|
-
else
|
21
|
-
if not condition
|
22
|
-
# If condition still not fulfilled (timeout but condition is 'false')
|
23
|
-
console.log "'waitFor()' timeout"
|
24
|
-
phantom.exit(1)
|
25
|
-
else
|
26
|
-
# Condition fulfilled (timeout and/or condition is 'true')
|
27
|
-
console.log "'waitFor()' finished in #{new Date().getTime() - start}ms."
|
28
|
-
if typeof onReady is 'string' then eval onReady else onReady() #< Do what it's supposed to do once the condition is fulfilled
|
29
|
-
clearInterval interval #< Stop this interval
|
30
|
-
interval = setInterval f, 250 #< repeat check every 250ms
|
31
|
-
|
32
|
-
|
33
|
-
page = require('webpage').create()
|
34
|
-
|
35
|
-
# Open Twitter on 'sencha' profile and, onPageLoad, do...
|
36
|
-
page.open 'http://twitter.com/#!/sencha', (status) ->
|
37
|
-
# Check for page load success
|
38
|
-
if status isnt 'success'
|
39
|
-
console.log 'Unable to access network'
|
40
|
-
else
|
41
|
-
# Wait for 'signin-dropdown' to be visible
|
42
|
-
waitFor ->
|
43
|
-
# Check in the page if a specific element is now visible
|
44
|
-
page.evaluate ->
|
45
|
-
$('#signin-dropdown').is ':visible'
|
46
|
-
, ->
|
47
|
-
console.log 'The sign-in dialog should be visible now.'
|
48
|
-
phantom.exit()
|
@@ -1,57 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Wait until the test condition is true or a timeout occurs. Useful for waiting
|
3
|
-
* on a server response or for a ui change (fadeIn, etc.) to occur.
|
4
|
-
*
|
5
|
-
* @param testFx javascript condition that evaluates to a boolean,
|
6
|
-
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
|
7
|
-
* as a callback function.
|
8
|
-
* @param onReady what to do when testFx condition is fulfilled,
|
9
|
-
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
|
10
|
-
* as a callback function.
|
11
|
-
* @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used.
|
12
|
-
*/
|
13
|
-
function waitFor(testFx, onReady, timeOutMillis) {
|
14
|
-
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3000, //< Default Max Timout is 3s
|
15
|
-
start = new Date().getTime(),
|
16
|
-
condition = false,
|
17
|
-
interval = setInterval(function() {
|
18
|
-
if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
|
19
|
-
// If not time-out yet and condition not yet fulfilled
|
20
|
-
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code
|
21
|
-
} else {
|
22
|
-
if(!condition) {
|
23
|
-
// If condition still not fulfilled (timeout but condition is 'false')
|
24
|
-
console.log("'waitFor()' timeout");
|
25
|
-
phantom.exit(1);
|
26
|
-
} else {
|
27
|
-
// Condition fulfilled (timeout and/or condition is 'true')
|
28
|
-
console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms.");
|
29
|
-
typeof(onReady) === "string" ? eval(onReady) : onReady(); //< Do what it's supposed to do once the condition is fulfilled
|
30
|
-
clearInterval(interval); //< Stop this interval
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}, 250); //< repeat check every 250ms
|
34
|
-
};
|
35
|
-
|
36
|
-
|
37
|
-
var page = require('webpage').create();
|
38
|
-
|
39
|
-
// Open Twitter on 'sencha' profile and, onPageLoad, do...
|
40
|
-
page.open("http://twitter.com/#!/sencha", function (status) {
|
41
|
-
// Check for page load success
|
42
|
-
if (status !== "success") {
|
43
|
-
console.log("Unable to access network");
|
44
|
-
} else {
|
45
|
-
// Wait for 'signin-dropdown' to be visible
|
46
|
-
waitFor(function() {
|
47
|
-
// Check in the page if a specific element is now visible
|
48
|
-
return page.evaluate(function() {
|
49
|
-
return $("#signin-dropdown").is(":visible");
|
50
|
-
});
|
51
|
-
}, function() {
|
52
|
-
console.log("The sign-in dialog should be visible now.");
|
53
|
-
phantom.exit();
|
54
|
-
});
|
55
|
-
}
|
56
|
-
});
|
57
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# Get weather info for given address (or for the default one, "Mountain View")
|
2
|
-
|
3
|
-
page = require('webpage').create()
|
4
|
-
system = require 'system'
|
5
|
-
address = 'Mountain View' #< default value
|
6
|
-
|
7
|
-
# Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
|
8
|
-
page.onConsoleMessage = (msg) ->
|
9
|
-
console.log msg
|
10
|
-
|
11
|
-
# Print usage message, if no address is passed
|
12
|
-
if system.args.length < 2
|
13
|
-
console.log 'Usage: weather.coffee [address]'
|
14
|
-
else
|
15
|
-
address = Array.prototype.slice.call(system.args, 1).join(' ')
|
16
|
-
|
17
|
-
# Heading
|
18
|
-
console.log "*** Loading weather information for '#{address}' ***\n"
|
19
|
-
|
20
|
-
# Open Google "secret" Weather API and, onPageLoad, do...
|
21
|
-
page.open encodeURI("http://www.google.com/ig/api?weather=#{address}"), (status) ->
|
22
|
-
# Check for page load success
|
23
|
-
if status isnt 'success'
|
24
|
-
console.log 'Unable to access network'
|
25
|
-
else
|
26
|
-
# Execute some DOM inspection within the page context
|
27
|
-
page.evaluate ->
|
28
|
-
if document.querySelectorAll('problem_cause').length > 0
|
29
|
-
console.log "No data available for #{address}"
|
30
|
-
else
|
31
|
-
data = (s, e) ->
|
32
|
-
e = e or document
|
33
|
-
el = e.querySelector s
|
34
|
-
if el then el.attributes.data.value else undefined
|
35
|
-
|
36
|
-
console.log """City: #{data 'weather > forecast_information > city'}
|
37
|
-
Current condition: #{data 'weather > current_conditions > condition'}
|
38
|
-
Temperature: #{data 'weather > current_conditions > temp_f'} F
|
39
|
-
#{data 'weather > current_conditions > humidity'}
|
40
|
-
#{data 'weather > current_conditions > wind_condition'}\n
|
41
|
-
"""
|
42
|
-
|
43
|
-
forecasts = document.querySelectorAll 'weather > forecast_conditions'
|
44
|
-
for i in forecasts
|
45
|
-
console.log "#{ data 'day_of_week', i }: " +
|
46
|
-
"#{ data 'low', i }-" +
|
47
|
-
"#{ data 'high', i } F " +
|
48
|
-
"#{ data 'condition', i }"
|
49
|
-
phantom.exit()
|
@@ -1,58 +0,0 @@
|
|
1
|
-
// Get weather info for given address (or for the default one, "Mountain View")
|
2
|
-
|
3
|
-
var page = require('webpage').create(),
|
4
|
-
system = require('system'),
|
5
|
-
address = "Mountain View"; //< default value
|
6
|
-
|
7
|
-
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
|
8
|
-
page.onConsoleMessage = function(msg) {
|
9
|
-
console.log(msg);
|
10
|
-
};
|
11
|
-
|
12
|
-
// Print usage message, if no address is passed
|
13
|
-
if (system.args.length < 2) {
|
14
|
-
console.log("Usage: weather.js [address]");
|
15
|
-
} else {
|
16
|
-
address = Array.prototype.slice.call(system.args, 1).join(' ');
|
17
|
-
}
|
18
|
-
|
19
|
-
// Heading
|
20
|
-
console.log("*** Loading weather information for '" + address + "' ***\n");
|
21
|
-
|
22
|
-
// Open Google "secret" Weather API and, onPageLoad, do...
|
23
|
-
page.open(encodeURI('http://www.google.com/ig/api?weather=' + address), function (status) {
|
24
|
-
// Check for page load success
|
25
|
-
if (status !== "success") {
|
26
|
-
console.log("Unable to access network");
|
27
|
-
} else {
|
28
|
-
// Execute some DOM inspection within the page context
|
29
|
-
page.evaluate(function() {
|
30
|
-
if (document.querySelectorAll('problem_cause').length > 0) {
|
31
|
-
console.log('No data available for ' + address);
|
32
|
-
} else {
|
33
|
-
function data (s, e) {
|
34
|
-
var el;
|
35
|
-
e = e || document;
|
36
|
-
el = e.querySelector(s);
|
37
|
-
return el ? el.attributes.data.value : undefined;
|
38
|
-
};
|
39
|
-
|
40
|
-
console.log('City: ' + data('weather > forecast_information > city'));
|
41
|
-
console.log('Current condition: ' + data('weather > current_conditions > condition'));
|
42
|
-
console.log('Temperature: ' + data('weather > current_conditions > temp_f') + ' F');
|
43
|
-
console.log(data('weather > current_conditions > humidity'));
|
44
|
-
console.log(data('weather > current_conditions > wind_condition'));
|
45
|
-
console.log('');
|
46
|
-
|
47
|
-
var forecasts = document.querySelectorAll('weather > forecast_conditions');
|
48
|
-
for (var i = 0; i < forecasts.length; ++i) {
|
49
|
-
var f = forecasts[i];
|
50
|
-
console.log(data('day_of_week', f) + ': ' +
|
51
|
-
data('low', f) + '-' + data('high', f) + ' F ' +
|
52
|
-
data('condition', f));
|
53
|
-
}
|
54
|
-
}
|
55
|
-
});
|
56
|
-
}
|
57
|
-
phantom.exit();
|
58
|
-
});
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# libQtCore.la - a libtool library file
|
2
|
-
# Generated by qmake/libtool (2.01a) (Qt 4.8.0) on: Fri Jan 13 11:58:43 2012
|
3
|
-
# The name that we can dlopen(3).
|
4
|
-
dlname='libQtCore.so.4'
|
5
|
-
|
6
|
-
# Names of this library.
|
7
|
-
library_names='libQtCore.so.4.8.0 libQtCore.so.4 libQtCore.so'
|
8
|
-
|
9
|
-
# The name of the static archive.
|
10
|
-
old_library='libQtCore.a'
|
11
|
-
|
12
|
-
# Libraries that this one depends upon.
|
13
|
-
dependency_libs='-L/home/turnip/phantomjs/src/qt/lib -lpthread '
|
14
|
-
|
15
|
-
# Version information for libQtCore.la
|
16
|
-
current=48
|
17
|
-
age=0
|
18
|
-
revision=0
|
19
|
-
|
20
|
-
# Is this an already installed library.
|
21
|
-
installed=yes
|
22
|
-
|
23
|
-
# Files to dlopen/dlpreopen.
|
24
|
-
dlopen=''
|
25
|
-
dlpreopen=''
|
26
|
-
|
27
|
-
# Directory that this library needs to be installed in:
|
28
|
-
libdir='/home/turnip/phantomjs/src/qt/lib'
|
@@ -1,7 +0,0 @@
|
|
1
|
-
QMAKE_PRL_BUILD_DIR = /home/turnip/phantomjs/src/qt/src/corelib/
|
2
|
-
QMAKE_PRO_INPUT = corelib.pro
|
3
|
-
QMAKE_PRL_TARGET = libQtCore.so.4.8.0
|
4
|
-
QMAKE_PRL_DEFINES = QT_SHARED
|
5
|
-
QMAKE_PRL_CONFIG = lex yacc warn_on uic resources qt warn_on release incremental link_prl gdb_dwarf_index qpa def_files_disabled no_mocdepend release qt_no_framework release shared dll qpa largefile precompile_header mmx 3dnow sse sse2 sse3 ssse3 sse4_1 sse4_2 avx exceptions_off dylib create_prl link_prl depend_includepath QTDIR_build qt_install_headers qt warn_on depend_includepath qmake_cache target_qt hide_symbols create_libtool create_pc explicitlib moc thread shared dll
|
6
|
-
QMAKE_PRL_VERSION = 4.8.0
|
7
|
-
QMAKE_PRL_LIBS = -L/home/turnip/phantomjs/src/qt/lib -lpthread
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# libQtGui.la - a libtool library file
|
2
|
-
# Generated by qmake/libtool (2.01a) (Qt 4.8.0) on: Fri Jan 13 11:58:47 2012
|
3
|
-
# The name that we can dlopen(3).
|
4
|
-
dlname='libQtGui.so.4'
|
5
|
-
|
6
|
-
# Names of this library.
|
7
|
-
library_names='libQtGui.so.4.8.0 libQtGui.so.4 libQtGui.so'
|
8
|
-
|
9
|
-
# The name of the static archive.
|
10
|
-
old_library='libQtGui.a'
|
11
|
-
|
12
|
-
# Libraries that this one depends upon.
|
13
|
-
dependency_libs='-L/home/turnip/phantomjs/src/qt/lib -lQtCore -L/home/turnip/phantomjs/src/qt/lib -lpthread '
|
14
|
-
|
15
|
-
# Version information for libQtGui.la
|
16
|
-
current=48
|
17
|
-
age=0
|
18
|
-
revision=0
|
19
|
-
|
20
|
-
# Is this an already installed library.
|
21
|
-
installed=yes
|
22
|
-
|
23
|
-
# Files to dlopen/dlpreopen.
|
24
|
-
dlopen=''
|
25
|
-
dlpreopen=''
|
26
|
-
|
27
|
-
# Directory that this library needs to be installed in:
|
28
|
-
libdir='/home/turnip/phantomjs/src/qt/lib'
|
@@ -1,7 +0,0 @@
|
|
1
|
-
QMAKE_PRL_BUILD_DIR = /home/turnip/phantomjs/src/qt/src/gui/
|
2
|
-
QMAKE_PRO_INPUT = gui.pro
|
3
|
-
QMAKE_PRL_TARGET = libQtGui.so.4.8.0
|
4
|
-
QMAKE_PRL_DEFINES = QT_SHARED
|
5
|
-
QMAKE_PRL_CONFIG = lex yacc warn_on uic resources qt warn_on release incremental link_prl gdb_dwarf_index qpa def_files_disabled no_mocdepend release qt_no_framework release shared dll qpa largefile precompile_header mmx 3dnow sse sse2 sse3 ssse3 sse4_1 sse4_2 avx exceptions_off dylib create_prl link_prl depend_includepath QTDIR_build qt_install_headers qt warn_on depend_includepath qmake_cache target_qt hide_symbols create_libtool create_pc explicitlib opentype moc thread shared dll
|
6
|
-
QMAKE_PRL_VERSION = 4.8.0
|
7
|
-
QMAKE_PRL_LIBS = -L/home/turnip/phantomjs/src/qt/lib -lQtCore -L/home/turnip/phantomjs/src/qt/lib -lpthread
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# libQtNetwork.la - a libtool library file
|
2
|
-
# Generated by qmake/libtool (2.01a) (Qt 4.8.0) on: Fri Jan 13 11:58:44 2012
|
3
|
-
# The name that we can dlopen(3).
|
4
|
-
dlname='libQtNetwork.so.4'
|
5
|
-
|
6
|
-
# Names of this library.
|
7
|
-
library_names='libQtNetwork.so.4.8.0 libQtNetwork.so.4 libQtNetwork.so'
|
8
|
-
|
9
|
-
# The name of the static archive.
|
10
|
-
old_library='libQtNetwork.a'
|
11
|
-
|
12
|
-
# Libraries that this one depends upon.
|
13
|
-
dependency_libs='-L/home/turnip/phantomjs/src/qt/lib -lQtCore -L/home/turnip/phantomjs/src/qt/lib -lpthread '
|
14
|
-
|
15
|
-
# Version information for libQtNetwork.la
|
16
|
-
current=48
|
17
|
-
age=0
|
18
|
-
revision=0
|
19
|
-
|
20
|
-
# Is this an already installed library.
|
21
|
-
installed=yes
|
22
|
-
|
23
|
-
# Files to dlopen/dlpreopen.
|
24
|
-
dlopen=''
|
25
|
-
dlpreopen=''
|
26
|
-
|
27
|
-
# Directory that this library needs to be installed in:
|
28
|
-
libdir='/home/turnip/phantomjs/src/qt/lib'
|
@@ -1,7 +0,0 @@
|
|
1
|
-
QMAKE_PRL_BUILD_DIR = /home/turnip/phantomjs/src/qt/src/network/
|
2
|
-
QMAKE_PRO_INPUT = network.pro
|
3
|
-
QMAKE_PRL_TARGET = libQtNetwork.so.4.8.0
|
4
|
-
QMAKE_PRL_DEFINES = QT_SHARED
|
5
|
-
QMAKE_PRL_CONFIG = lex yacc warn_on uic resources qt warn_on release incremental link_prl gdb_dwarf_index qpa def_files_disabled no_mocdepend release qt_no_framework release shared dll qpa largefile precompile_header mmx 3dnow sse sse2 sse3 ssse3 sse4_1 sse4_2 avx exceptions_off dylib create_prl link_prl depend_includepath QTDIR_build qt_install_headers qt warn_on depend_includepath qmake_cache target_qt hide_symbols create_libtool create_pc explicitlib moc thread shared dll
|
6
|
-
QMAKE_PRL_VERSION = 4.8.0
|
7
|
-
QMAKE_PRL_LIBS = -L/home/turnip/phantomjs/src/qt/lib -lQtCore -L/home/turnip/phantomjs/src/qt/lib -lpthread
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# libQtWebKit.la - a libtool library file
|
2
|
-
# Generated by qmake/libtool (2.01a) (Qt 4.8.0) on: Fri Jan 13 14:45:44 2012
|
3
|
-
# The name that we can dlopen(3).
|
4
|
-
dlname='libQtWebKit.so.4'
|
5
|
-
|
6
|
-
# Names of this library.
|
7
|
-
library_names='libQtWebKit.so.4.9.0 libQtWebKit.so.4 libQtWebKit.so'
|
8
|
-
|
9
|
-
# The name of the static archive.
|
10
|
-
old_library='libQtWebKit.a'
|
11
|
-
|
12
|
-
# Libraries that this one depends upon.
|
13
|
-
dependency_libs='-L/home/turnip/phantomjs/src/qt/lib -L../../WebCore/release -L../../JavaScriptCore/release -lwebcore -L/home/turnip/phantomjs/src/qt/lib -ljscore -lQtGui -lQtNetwork -lQtCore -lpthread '
|
14
|
-
|
15
|
-
# Version information for libQtWebKit.la
|
16
|
-
current=49
|
17
|
-
age=0
|
18
|
-
revision=0
|
19
|
-
|
20
|
-
# Is this an already installed library.
|
21
|
-
installed=yes
|
22
|
-
|
23
|
-
# Files to dlopen/dlpreopen.
|
24
|
-
dlopen=''
|
25
|
-
dlpreopen=''
|
26
|
-
|
27
|
-
# Directory that this library needs to be installed in:
|
28
|
-
libdir='/home/turnip/phantomjs/src/qt/lib'
|