-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
var path = require('path') | ||
var childProcess = require('child_process') | ||
var phantomjs = require('phantomjs-prebuilt') | ||
var binPath = phantomjs.path | ||
|
||
|
||
var source = '<!DOCTYPE html><html lang="en"><meta charset="utf-8"><head><title>Home - PayPal Accessibility Tool</title></head><body>' | ||
+ '<div>Test div : <input> </div>' | ||
+ '</body></html>'; | ||
|
||
var childArgs = [ | ||
path.join(__dirname, 'ptest2.js'), | ||
source | ||
] | ||
|
||
childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) { | ||
// handle results | ||
console.log('Error', JSON.stringify(stderr)); | ||
console.log('Output', JSON.stringify(stdout)); | ||
}) | ||
|
||
|
||
|
||
|
||
/* | ||
if ( typeof(phantom) !== "undefined" ) { | ||
var page = require('webpage').create(); | ||
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this") | ||
page.onConsoleMessage = function(msg) { | ||
console.log(msg); | ||
}; | ||
page.onAlert = function(msg) { | ||
console.log(msg); | ||
}; | ||
console.log("* Script running in the Phantom context."); | ||
console.log("* Script will 'inject' itself in a page..."); | ||
page.open("about:blank", function(status) { | ||
if ( status === "success" ) { | ||
console.log(page.injectJs("injectme.js") ? "... done injecting itself!" : "... fail! Check the $PWD?!"); | ||
} | ||
phantom.exit(); | ||
}); | ||
} else { | ||
console.log("* Script running in the Page context."); | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var args = require('system').args; | ||
var source= args[1]; | ||
var page = require('webpage').create(); | ||
var PATH_TO_AXE = './src/axe/axe.js'; | ||
|
||
page.settings.webSecurityEnabled = false; | ||
page.content = source; | ||
|
||
page.injectJs(PATH_TO_AXE); | ||
page.framesName.forEach(function (name) { | ||
page.switchToFrame(name); | ||
page.injectJs(PATH_TO_AXE); | ||
}); | ||
page.switchToMainFrame(); | ||
page.evaluate(function () { | ||
axe.run(document.body, function(err, results) { | ||
window.callPhantom(results); | ||
}); | ||
}); | ||
|
||
page.onCallback = function (results) { | ||
console.log(JSON.stringify(results)) | ||
phantom.exit(); | ||
} |