Skip to content

Instantly share code, notes, and snippets.

@ueokande
Created April 26, 2017 13:40
Show Gist options
  • Save ueokande/71ee36460f7a63ad8fbc90260f55fade to your computer and use it in GitHub Desktop.
Save ueokande/71ee36460f7a63ad8fbc90260f55fade to your computer and use it in GitHub Desktop.
var page = require('webpage').create();
page.open('http://www.tamagoya.co.jp/menu_list.html', function() {
var rect = page.evaluate(function() {
var menuDate = Array.prototype.find.call(
document.querySelectorAll('.menutitle_date'),
(e) => e.textContent.includes("26") );
var menuTitle = menu_date.parentElement;
var menuList = menuTitle.nextElementSibling
var menuBottom = menuList.nextElementSibling
});
// page.viewportSize = { width: rect.width, height: rect.height };
//the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = { top: rect.top, left: rect.left, width: rect.width, height: rect.height };
page.render('github.png');
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment