├── README.md ├── examples ├── arguments.js ├── child_process-examples.js ├── colorwheel.js ├── countdown.js ├── detectsniff.js ├── echoToFile.js ├── features.js ├── fibo.js ├── hello.js ├── injectme.js ├── loadspeed.js ├── loadurlwithoutcss.js ├── modernizr.js ├── module.js ├── netlog.js ├── netsniff.js ├── openurlwithproxy.js ├── outputEncoding.js ├── page_events.js ├── pagecallback.js ├── phantomwebintro.js ├── post.js ├── postjson.js ├── postserver.js ├── printenv.js ├── printheaderfooter.js ├── printmargins.js ├── rasterize.js ├── render_multi_url.js ├── responsive-screenshot.js ├── run-jasmine.js ├── run-jasmine2.js ├── run-qunit.js ├── scandir.js ├── server.js ├── serverkeepalive.js ├── simpleserver.js ├── sleepsort.js ├── stdin-stdout-stderr.js ├── universe.js ├── unrandomize.js ├── useragent.js ├── version.js ├── waitfor.js └── walk_through_frames.js └── phantomjs.zip /README.md: -------------------------------------------------------------------------------- 1 | # PhantomJS-Raspberry-Pi-3- 2 | PhantomJS compiled on a Raspberry Pi 3, working binary ready to download and run. 3 | 4 | ##Directions 5 | -Unzip phantomjs.zip 6 | ####(note this is zipped because I couldn't upload it to github otherwise and you need the compiled binary which still takes many hours on a Raspberry Pi 3 to do). 7 | 8 | ###Directions to run 9 | - Without direct installation you will have to run the full directory of the location 10 | - /{current working directory}/phantomjs -arg1 11 | 12 | Problems? Please let me know. 13 | -------------------------------------------------------------------------------- /examples/arguments.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var system = require('system'); 3 | if (system.args.length === 1) { 4 | console.log('Try to pass some args when invoking this script!'); 5 | } else { 6 | system.args.forEach(function (arg, i) { 7 | console.log(i + ': ' + arg); 8 | }); 9 | } 10 | phantom.exit(); 11 | -------------------------------------------------------------------------------- /examples/child_process-examples.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var spawn = require("child_process").spawn 3 | var execFile = require("child_process").execFile 4 | 5 | var child = spawn("ls", ["-lF", "/rooot"]) 6 | 7 | child.stdout.on("data", function (data) { 8 | console.log("spawnSTDOUT:", JSON.stringify(data)) 9 | }) 10 | 11 | child.stderr.on("data", function (data) { 12 | console.log("spawnSTDERR:", JSON.stringify(data)) 13 | }) 14 | 15 | child.on("exit", function (code) { 16 | console.log("spawnEXIT:", code) 17 | }) 18 | 19 | //child.kill("SIGKILL") 20 | 21 | execFile("ls", ["-lF", "/usr"], null, function (err, stdout, stderr) { 22 | console.log("execFileSTDOUT:", JSON.stringify(stdout)) 23 | console.log("execFileSTDERR:", JSON.stringify(stderr)) 24 | }) 25 | 26 | setTimeout(function () { 27 | phantom.exit(0) 28 | }, 2000) 29 | -------------------------------------------------------------------------------- /examples/colorwheel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var page = require('webpage').create(); 3 | page.viewportSize = { width: 400, height : 400 }; 4 | page.content = '
'; 5 | page.evaluate(function() { 6 | var el = document.getElementById('surface'), 7 | context = el.getContext('2d'), 8 | width = window.innerWidth, 9 | height = window.innerHeight, 10 | cx = width / 2, 11 | cy = height / 2, 12 | radius = width / 2.3, 13 | imageData, 14 | pixels, 15 | hue, sat, value, 16 | i = 0, x, y, rx, ry, d, 17 | f, g, p, u, v, w, rgb; 18 | 19 | el.width = width; 20 | el.height = height; 21 | imageData = context.createImageData(width, height); 22 | pixels = imageData.data; 23 | 24 | for (y = 0; y < height; y = y + 1) { 25 | for (x = 0; x < width; x = x + 1, i = i + 4) { 26 | rx = x - cx; 27 | ry = y - cy; 28 | d = rx * rx + ry * ry; 29 | if (d < radius * radius) { 30 | hue = 6 * (Math.atan2(ry, rx) + Math.PI) / (2 * Math.PI); 31 | sat = Math.sqrt(d) / radius; 32 | g = Math.floor(hue); 33 | f = hue - g; 34 | u = 255 * (1 - sat); 35 | v = 255 * (1 - sat * f); 36 | w = 255 * (1 - sat * (1 - f)); 37 | pixels[i] = [255, v, u, u, w, 255, 255][g]; 38 | pixels[i + 1] = [w, 255, 255, v, u, u, w][g]; 39 | pixels[i + 2] = [u, u, w, 255, 255, v, u][g]; 40 | pixels[i + 3] = 255; 41 | } 42 | } 43 | } 44 | 45 | context.putImageData(imageData, 0, 0); 46 | document.body.style.backgroundColor = 'white'; 47 | document.body.style.margin = '0px'; 48 | }); 49 | 50 | page.render('colorwheel.png'); 51 | 52 | phantom.exit(); 53 | -------------------------------------------------------------------------------- /examples/countdown.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var t = 10, 3 | interval = setInterval(function(){ 4 | if ( t > 0 ) { 5 | console.log(t--); 6 | } else { 7 | console.log("BLAST OFF!"); 8 | phantom.exit(); 9 | } 10 | }, 1000); 11 | -------------------------------------------------------------------------------- /examples/detectsniff.js: -------------------------------------------------------------------------------- 1 | // Detect if a web page sniffs the user agent or not. 2 | 3 | "use strict"; 4 | var page = require('webpage').create(), 5 | system = require('system'), 6 | sniffed, 7 | address; 8 | 9 | page.onInitialized = function () { 10 | page.evaluate(function () { 11 | 12 | (function () { 13 | var userAgent = window.navigator.userAgent, 14 | platform = window.navigator.platform; 15 | 16 | window.navigator = { 17 | appCodeName: 'Mozilla', 18 | appName: 'Netscape', 19 | cookieEnabled: false, 20 | sniffed: false 21 | }; 22 | 23 | window.navigator.__defineGetter__('userAgent', function () { 24 | window.navigator.sniffed = true; 25 | return userAgent; 26 | }); 27 | 28 | window.navigator.__defineGetter__('platform', function () { 29 | window.navigator.sniffed = true; 30 | return platform; 31 | }); 32 | })(); 33 | }); 34 | }; 35 | 36 | if (system.args.length === 1) { 37 | console.log('Usage: detectsniff.jsasdfadsfycvx
64 | 65 | */ 66 | if (page.evaluate(function(){return typeof PhantomJSPrinting == "object";})) { 67 | paperSize = page.paperSize; 68 | paperSize.header.height = page.evaluate(function() { 69 | return PhantomJSPrinting.header.height; 70 | }); 71 | paperSize.header.contents = phantom.callback(function(pageNum, numPages) { 72 | return page.evaluate(function(pageNum, numPages){return PhantomJSPrinting.header.contents(pageNum, numPages);}, pageNum, numPages); 73 | }); 74 | paperSize.footer.height = page.evaluate(function() { 75 | return PhantomJSPrinting.footer.height; 76 | }); 77 | paperSize.footer.contents = phantom.callback(function(pageNum, numPages) { 78 | return page.evaluate(function(pageNum, numPages){return PhantomJSPrinting.footer.contents(pageNum, numPages);}, pageNum, numPages); 79 | }); 80 | page.paperSize = paperSize; 81 | console.log(page.paperSize.header.height); 82 | console.log(page.paperSize.footer.height); 83 | } 84 | window.setTimeout(function () { 85 | page.render(output); 86 | phantom.exit(); 87 | }, 200); 88 | } 89 | }); 90 | } 91 | -------------------------------------------------------------------------------- /examples/printmargins.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var page = require('webpage').create(), 3 | system = require('system'); 4 | 5 | if (system.args.length < 7) { 6 | console.log('Usage: printmargins.js URL filename LEFT TOP RIGHT BOTTOM'); 7 | console.log(' margin examples: "1cm", "10px", "7mm", "5in"'); 8 | phantom.exit(1); 9 | } else { 10 | var address = system.args[1]; 11 | var output = system.args[2]; 12 | var marginLeft = system.args[3]; 13 | var marginTop = system.args[4]; 14 | var marginRight = system.args[5]; 15 | var marginBottom = system.args[6]; 16 | page.viewportSize = { width: 600, height: 600 }; 17 | page.paperSize = { 18 | format: 'A4', 19 | margin: { 20 | left: marginLeft, 21 | top: marginTop, 22 | right: marginRight, 23 | bottom: marginBottom 24 | } 25 | }; 26 | page.open(address, function (status) { 27 | if (status !== 'success') { 28 | console.log('Unable to load the address!'); 29 | } else { 30 | window.setTimeout(function () { 31 | page.render(output); 32 | phantom.exit(); 33 | }, 200); 34 | } 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /examples/rasterize.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var page = require('webpage').create(), 3 | system = require('system'), 4 | address, output, size; 5 | 6 | if (system.args.length < 3 || system.args.length > 5) { 7 | console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]'); 8 | console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); 9 | console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px'); 10 | console.log(' "800px*600px" window, clipped to 800x600'); 11 | phantom.exit(1); 12 | } else { 13 | address = system.args[1]; 14 | output = system.args[2]; 15 | page.viewportSize = { width: 600, height: 600 }; 16 | if (system.args.length > 3 && system.args[2].substr(-4) === ".pdf") { 17 | size = system.args[3].split('*'); 18 | page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' } 19 | : { format: system.args[3], orientation: 'portrait', margin: '1cm' }; 20 | } else if (system.args.length > 3 && system.args[3].substr(-2) === "px") { 21 | size = system.args[3].split('*'); 22 | if (size.length === 2) { 23 | pageWidth = parseInt(size[0], 10); 24 | pageHeight = parseInt(size[1], 10); 25 | page.viewportSize = { width: pageWidth, height: pageHeight }; 26 | page.clipRect = { top: 0, left: 0, width: pageWidth, height: pageHeight }; 27 | } else { 28 | console.log("size:", system.args[3]); 29 | pageWidth = parseInt(system.args[3], 10); 30 | pageHeight = parseInt(pageWidth * 3/4, 10); // it's as good an assumption as any 31 | console.log ("pageHeight:",pageHeight); 32 | page.viewportSize = { width: pageWidth, height: pageHeight }; 33 | } 34 | } 35 | if (system.args.length > 4) { 36 | page.zoomFactor = system.args[4]; 37 | } 38 | page.open(address, function (status) { 39 | if (status !== 'success') { 40 | console.log('Unable to load the address!'); 41 | phantom.exit(1); 42 | } else { 43 | window.setTimeout(function () { 44 | page.render(output); 45 | phantom.exit(); 46 | }, 200); 47 | } 48 | }); 49 | } 50 | -------------------------------------------------------------------------------- /examples/render_multi_url.js: -------------------------------------------------------------------------------- 1 | // Render Multiple URLs to file 2 | 3 | "use strict"; 4 | var RenderUrlsToFile, arrayOfUrls, system; 5 | 6 | system = require("system"); 7 | 8 | /* 9 | Render given urls 10 | @param array of URLs to render 11 | @param callbackPerUrl Function called after finishing each URL, including the last URL 12 | @param callbackFinal Function called after finishing everything 13 | */ 14 | RenderUrlsToFile = function(urls, callbackPerUrl, callbackFinal) { 15 | var getFilename, next, page, retrieve, urlIndex, webpage; 16 | urlIndex = 0; 17 | webpage = require("webpage"); 18 | page = null; 19 | getFilename = function() { 20 | return "rendermulti-" + urlIndex + ".png"; 21 | }; 22 | next = function(status, url, file) { 23 | page.close(); 24 | callbackPerUrl(status, url, file); 25 | return retrieve(); 26 | }; 27 | retrieve = function() { 28 | var url; 29 | if (urls.length > 0) { 30 | url = urls.shift(); 31 | urlIndex++; 32 | page = webpage.create(); 33 | page.viewportSize = { 34 | width: 800, 35 | height: 600 36 | }; 37 | page.settings.userAgent = "Phantom.js bot"; 38 | return page.open("http://" + url, function(status) { 39 | var file; 40 | file = getFilename(); 41 | if (status === "success") { 42 | return window.setTimeout((function() { 43 | page.render(file); 44 | return next(status, url, file); 45 | }), 200); 46 | } else { 47 | return next(status, url, file); 48 | } 49 | }); 50 | } else { 51 | return callbackFinal(); 52 | } 53 | }; 54 | return retrieve(); 55 | }; 56 | 57 | arrayOfUrls = null; 58 | 59 | if (system.args.length > 1) { 60 | arrayOfUrls = Array.prototype.slice.call(system.args, 1); 61 | } else { 62 | console.log("Usage: phantomjs render_multi_url.js [domain.name1, domain.name2, ...]"); 63 | arrayOfUrls = ["www.google.com", "www.bbc.co.uk", "phantomjs.org"]; 64 | } 65 | 66 | RenderUrlsToFile(arrayOfUrls, (function(status, url, file) { 67 | if (status !== "success") { 68 | return console.log("Unable to render '" + url + "'"); 69 | } else { 70 | return console.log("Rendered '" + url + "' at '" + file + "'"); 71 | } 72 | }), function() { 73 | return phantom.exit(); 74 | }); 75 | -------------------------------------------------------------------------------- /examples/responsive-screenshot.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Captures the full height document even if it's not showing on the screen or captures with the provided range of screen sizes. 3 | * 4 | * A basic example for taking a screen shot using phantomjs which is sampled for https://nodejs-dersleri.github.io/ 5 | * 6 | * usage : phantomjs responsive-screenshot.js {url} [output format] [doClipping] 7 | * 8 | * examples > 9 | * phantomjs responsive-screenshot.js https://nodejs-dersleri.github.io/ 10 | * phantomjs responsive-screenshot.js https://nodejs-dersleri.github.io/ pdf 11 | * phantomjs responsive-screenshot.js https://nodejs-dersleri.github.io/ true 12 | * phantomjs responsive-screenshot.js https://nodejs-dersleri.github.io/ png true 13 | * 14 | * @author Salih sagdilekpretty cool :)");
26 | response.close();
27 | });
28 | if (!listening) {
29 | console.log("could not create web server listening on port " + port);
30 | phantom.exit();
31 | }
32 | var url = "http://localhost:" + port + "/foo/bar.php?asdf=true";
33 | console.log("SENDING REQUEST TO:");
34 | console.log(url);
35 | page.open(url, function (status) {
36 | if (status !== 'success') {
37 | console.log('FAIL to load the address');
38 | } else {
39 | console.log("GOT REPLY FROM SERVER:");
40 | console.log(page.content);
41 | }
42 | phantom.exit();
43 | });
44 | }
45 |
--------------------------------------------------------------------------------
/examples/serverkeepalive.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var port, server, service,
3 | system = require('system');
4 |
5 | if (system.args.length !== 2) {
6 | console.log('Usage: serverkeepalive.js This is from PhantomJS web server. Request data:');
30 | response.write(JSON.stringify(request, null, 4));
31 | response.write('
');
32 | response.write('');
33 | response.write('');
34 | response.close();
35 | });
36 |
37 | if (service) {
38 | console.log('Web server running on port ' + port);
39 | } else {
40 | console.log('Error: Could not create web server listening on port ' + port);
41 | phantom.exit();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/examples/sleepsort.js:
--------------------------------------------------------------------------------
1 | // sleepsort.js - Sort integers from the commandline in a very ridiculous way: leveraging timeouts :P
2 |
3 | "use strict";
4 | var system = require('system');
5 |
6 | function sleepSort(array, callback) {
7 | var sortedCount = 0,
8 | i, len;
9 | for ( i = 0, len = array.length; i < len; ++i ) {
10 | setTimeout((function(j){
11 | return function() {
12 | console.log(array[j]);
13 | ++sortedCount;
14 | (len === sortedCount) && callback();
15 | };
16 | }(i)), array[i]);
17 | }
18 | }
19 |
20 | if ( system.args.length < 2 ) {
21 | console.log("Usage: phantomjs sleepsort.js PUT YOUR INTEGERS HERE SEPARATED BY SPACES");
22 | phantom.exit(1);
23 | } else {
24 | sleepSort(system.args.slice(1), function() {
25 | phantom.exit();
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/examples/stdin-stdout-stderr.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var system = require('system');
3 |
4 | system.stdout.write('Hello, system.stdout.write!');
5 | system.stdout.writeLine('\nHello, system.stdout.writeLine!');
6 |
7 | system.stderr.write('Hello, system.stderr.write!');
8 | system.stderr.writeLine('\nHello, system.stderr.writeLine!');
9 |
10 | system.stdout.writeLine('system.stdin.readLine(): ');
11 | var line = system.stdin.readLine();
12 | system.stdout.writeLine(JSON.stringify(line));
13 |
14 | // This is essentially a `readAll`
15 | system.stdout.writeLine('system.stdin.read(5): (ctrl+D to end)');
16 | var input = system.stdin.read(5);
17 | system.stdout.writeLine(JSON.stringify(input));
18 |
19 | phantom.exit(0);
20 |
--------------------------------------------------------------------------------
/examples/universe.js:
--------------------------------------------------------------------------------
1 | // This is to be used by "module.js" (and "module.coffee") example(s).
2 | // There should NOT be a "universe.coffee" as only 1 of the 2 would
3 | // ever be loaded unless the file extension was specified.
4 |
5 | "use strict";
6 | exports.answer = 42;
7 |
8 | exports.start = function () {
9 | console.log('Starting the universe....');
10 | }
11 |
--------------------------------------------------------------------------------
/examples/unrandomize.js:
--------------------------------------------------------------------------------
1 | // Modify global object at the page initialization.
2 | // In this example, effectively Math.random() always returns 0.42.
3 |
4 | "use strict";
5 | var page = require('webpage').create();
6 |
7 | page.onInitialized = function () {
8 | page.evaluate(function () {
9 | Math.random = function() {
10 | return 42 / 100;
11 | };
12 | });
13 | };
14 |
15 | page.open('http://ariya.github.com/js/random/', function (status) {
16 | var result;
17 | if (status !== 'success') {
18 | console.log('Network error.');
19 | } else {
20 | console.log(page.evaluate(function () {
21 | return document.getElementById('numbers').textContent;
22 | }));
23 | }
24 | phantom.exit();
25 | });
26 |
--------------------------------------------------------------------------------
/examples/useragent.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var page = require('webpage').create();
3 | console.log('The default user agent is ' + page.settings.userAgent);
4 | page.settings.userAgent = 'SpecialAgent';
5 | page.open('http://www.httpuseragent.org', function (status) {
6 | if (status !== 'success') {
7 | console.log('Unable to access network');
8 | } else {
9 | var ua = page.evaluate(function () {
10 | return document.getElementById('myagent').innerText;
11 | });
12 | console.log(ua);
13 | }
14 | phantom.exit();
15 | });
16 |
--------------------------------------------------------------------------------
/examples/version.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | console.log('using PhantomJS version ' +
3 | phantom.version.major + '.' +
4 | phantom.version.minor + '.' +
5 | phantom.version.patch);
6 | phantom.exit();
7 |
--------------------------------------------------------------------------------
/examples/waitfor.js:
--------------------------------------------------------------------------------
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 |
14 | "use strict";
15 | function waitFor(testFx, onReady, timeOutMillis) {
16 | var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3000, //< Default Max Timout is 3s
17 | start = new Date().getTime(),
18 | condition = false,
19 | interval = setInterval(function() {
20 | if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
21 | // If not time-out yet and condition not yet fulfilled
22 | condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code
23 | } else {
24 | if(!condition) {
25 | // If condition still not fulfilled (timeout but condition is 'false')
26 | console.log("'waitFor()' timeout");
27 | phantom.exit(1);
28 | } else {
29 | // Condition fulfilled (timeout and/or condition is 'true')
30 | console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms.");
31 | typeof(onReady) === "string" ? eval(onReady) : onReady(); //< Do what it's supposed to do once the condition is fulfilled
32 | clearInterval(interval); //< Stop this interval
33 | }
34 | }
35 | }, 250); //< repeat check every 250ms
36 | };
37 |
38 |
39 | var page = require('webpage').create();
40 |
41 | // Open Twitter on 'sencha' profile and, onPageLoad, do...
42 | page.open("http://twitter.com/#!/sencha", function (status) {
43 | // Check for page load success
44 | if (status !== "success") {
45 | console.log("Unable to access network");
46 | } else {
47 | // Wait for 'signin-dropdown' to be visible
48 | waitFor(function() {
49 | // Check in the page if a specific element is now visible
50 | return page.evaluate(function() {
51 | return $("#signin-dropdown").is(":visible");
52 | });
53 | }, function() {
54 | console.log("The sign-in dialog should be visible now.");
55 | phantom.exit();
56 | });
57 | }
58 | });
59 |
--------------------------------------------------------------------------------
/examples/walk_through_frames.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var p = require("webpage").create();
3 |
4 | function pageTitle(page) {
5 | return page.evaluate(function(){
6 | return window.document.title;
7 | });
8 | }
9 |
10 | function setPageTitle(page, newTitle) {
11 | page.evaluate(function(newTitle){
12 | window.document.title = newTitle;
13 | }, newTitle);
14 | }
15 |
16 | p.open("../test/webpage-spec-frames/index.html", function(status) {
17 | console.log("pageTitle(): " + pageTitle(p));
18 | console.log("currentFrameName(): "+p.currentFrameName());
19 | console.log("childFramesCount(): "+p.childFramesCount());
20 | console.log("childFramesName(): "+p.childFramesName());
21 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
22 | console.log("");
23 |
24 | console.log("p.switchToChildFrame(\"frame1\"): "+p.switchToChildFrame("frame1"));
25 | console.log("pageTitle(): " + pageTitle(p));
26 | console.log("currentFrameName(): "+p.currentFrameName());
27 | console.log("childFramesCount(): "+p.childFramesCount());
28 | console.log("childFramesName(): "+p.childFramesName());
29 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
30 | console.log("");
31 |
32 | console.log("p.switchToChildFrame(\"frame1-2\"): "+p.switchToChildFrame("frame1-2"));
33 | console.log("pageTitle(): " + pageTitle(p));
34 | console.log("currentFrameName(): "+p.currentFrameName());
35 | console.log("childFramesCount(): "+p.childFramesCount());
36 | console.log("childFramesName(): "+p.childFramesName());
37 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
38 | console.log("");
39 |
40 | console.log("p.switchToParentFrame(): "+p.switchToParentFrame());
41 | console.log("pageTitle(): " + pageTitle(p));
42 | console.log("currentFrameName(): "+p.currentFrameName());
43 | console.log("childFramesCount(): "+p.childFramesCount());
44 | console.log("childFramesName(): "+p.childFramesName());
45 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
46 | console.log("");
47 |
48 | console.log("p.switchToChildFrame(0): "+p.switchToChildFrame(0));
49 | console.log("pageTitle(): " + pageTitle(p));
50 | console.log("currentFrameName(): "+p.currentFrameName());
51 | console.log("childFramesCount(): "+p.childFramesCount());
52 | console.log("childFramesName(): "+p.childFramesName());
53 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
54 | console.log("");
55 |
56 | console.log("p.switchToMainFrame()"); p.switchToMainFrame();
57 | console.log("pageTitle(): " + pageTitle(p));
58 | console.log("currentFrameName(): "+p.currentFrameName());
59 | console.log("childFramesCount(): "+p.childFramesCount());
60 | console.log("childFramesName(): "+p.childFramesName());
61 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
62 | console.log("");
63 |
64 | console.log("p.switchToChildFrame(\"frame2\"): "+p.switchToChildFrame("frame2"));
65 | console.log("pageTitle(): " + pageTitle(p));
66 | console.log("currentFrameName(): "+p.currentFrameName());
67 | console.log("childFramesCount(): "+p.childFramesCount());
68 | console.log("childFramesName(): "+p.childFramesName());
69 | console.log("setPageTitle(CURRENT TITLE+'-visited')"); setPageTitle(p, pageTitle(p) + "-visited");
70 | console.log("");
71 |
72 | phantom.exit();
73 | });
74 |
--------------------------------------------------------------------------------
/phantomjs.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewsyc/PhantomJS-Raspberry-Pi-3-/81ccd705cca08f2bed8078ee5ef1f190b6aebbfe/phantomjs.zip
--------------------------------------------------------------------------------