source: other-projects/FileTransfer-WebSocketPair/Themes/themebuilder/bin/phantomjs-1.9.2-windows/examples/unrandomize.js@ 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: 641 bytes
Line 
1// Modify global object at the page initialization.
2// In this example, effectively Math.random() always returns 0.42.
3
4var page = require('webpage').create();
5
6page.onInitialized = function () {
7 page.evaluate(function () {
8 Math.random = function() {
9 return 42 / 100;
10 };
11 });
12};
13
14page.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});
Note: See TracBrowser for help on using the repository browser.