Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / phantomjs / lib / phantom / examples / unrandomize.js
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 });