How to use webpage - 10 common examples

To help you get started, we’ve selected a few webpage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xieren58 / 17qingsong / practice / phantom.js View on Github external
var page = require('webpage').create();

var url = 'http://www.17qingsong.com/news/8JTND98F00964JJM';

page.viewportSize = {width: 1170, height: 7824};

page.open(url, function (status) {
    // var height = page.evaluate(function() { return document.body.clientHeight; });
    // var width = page.evaluate(function() { return document.body.clientWidth; });
    // console.log(height);
    // page.viewportSize = {width: 1170, height: height};
    page.render('17.jpg');
    // page.render('17.pdf');
    phantom.exit();
});
github jason-green-io / littlepod / minecraft-builds.js View on Github external
var page = require('webpage').create(), system = require('system'), address, output;
//viewportSize being the actual size of the headless browser
page.viewportSize = { width: 1024, height: 768 };
//the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = { top: 192, left: 256, width: 512, height: 384 };
//the rest of the code is the same as the previous example
address = system.args[1];
output = system.args[2];
page.settings.resourceTimeout = 10000; // Avoid freeze!!!
page.open(address, function() {
window.setTimeout(function () {
                page.render(output);
                phantom.exit();
            }, 2000);
});
github tav / asciinema2gif / render.js View on Github external
function newPage() {
  var page = webpage.create();
  page.onResourceError = function (err) {
    failure = err.errorString;
  };
  page.onResourceReceived = function (resource) {
    page.statusCode = resource.status;
  }
  // Uncomment this to see console.log calls from within pages.
  // page.onConsoleMessage = function (info) {
  //   console.log(info);
  // };
  return page;
}
github khilnani / supercollider.web / tests / phantomjs / google.js View on Github external
var page = require('webpage').create();
page.open('http://google.com', function(status) {
    var title = page.evaluate(function() {
        return document.title;
    });
    console.log(title);
    phantom.exit();
});
github mc-zone / bundle-ensure-webpack-plugin / tests / withHtmlPlugin / scripts / page1.phantom.js View on Github external
var fs = require("fs");
var page = require("webpage").create();

var htmlPath = fs.absolute("tests/withHtmlPlugin/dist/index1.html");

page.onConsoleMessage = function(msg, lineNum, sourceId) {
  console.log(msg);
};

page.open("file://" + htmlPath, function(status) {
  phantom.exit();
});
github mc-zone / bundle-ensure-webpack-plugin / tests / withHtmlPlugin / scripts / page2-1.phantom.js View on Github external
var fs = require("fs");
var page = require("webpage").create();

var htmlPath = fs.absolute(
  "tests/withHtmlPlugin/dist/index2-missingcommon.html"
);

page.onConsoleMessage = function(msg, lineNum, sourceId) {
  console.log(msg);
};

page.open("file://" + htmlPath, function(status) {
  phantom.exit();
});
github mc-zone / bundle-ensure-webpack-plugin / tests / withHtmlPlugin / scripts / page2-2.phantom.js View on Github external
var fs = require("fs");
var page = require("webpage").create();

var htmlPath = fs.absolute(
  "tests/withHtmlPlugin/dist/index2-missingindex.html"
);

page.onConsoleMessage = function(msg, lineNum, sourceId) {
  console.log(msg);
};

page.open("file://" + htmlPath, function(status) {
  phantom.exit();
});
github mc-zone / bundle-ensure-webpack-plugin / tests / withHtmlPlugin / scripts / page2-3.phantom.js View on Github external
var fs = require("fs");
var page = require("webpage").create();

var htmlPath = fs.absolute("tests/withHtmlPlugin/dist/index2-missingall.html");

page.onConsoleMessage = function(msg, lineNum, sourceId) {
  console.log(msg);
};

page.open("file://" + htmlPath, function(status) {
  phantom.exit();
});
github mc-zone / bundle-ensure-webpack-plugin / tests / withHtmlPlugin / scripts / page3-1.phantom.js View on Github external
var fs = require("fs");
var page = require("webpage").create();

var htmlPath = fs.absolute("tests/withHtmlPlugin/dist/index-muti.html");

page.onConsoleMessage = function(msg, lineNum, sourceId) {
  console.log(msg);
};

page.open("file://" + htmlPath, function(status) {
  phantom.exit();
});
github SlapOS / slapos / software / davstorage / templates / test-boot.js View on Github external
var page = require('webpage').create();
var url = '${:content-url}'

page.open(url,function(status){
  var form = page.evaluate(function(){
    return document.getElementById('login_form');
  });

  if(form === null){
    phantom.exit(1);
  } else {
    phantom.exit();
  }
});

webpage

Webpage Boilerplate Component

MIT
Latest version published 9 years ago

Package Health Score

45 / 100
Full package analysis

Popular webpage functions