Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added netlify-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "graphene-ecommerce-example",
"dependencies": {
"playwright": "^1.56.0"
},
"graphene": {
"dialect": "bigquery"
Expand Down
45 changes: 45 additions & 0 deletions screenshot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const { chromium } = require('playwright');

async function takeScreenshot() {
const browser = await chromium.launch();
const page = await browser.newPage();

// Navigate to netlify.com
await page.goto('https://netlify.com');

// Wait for the page to load
await page.waitForLoadState('domcontentloaded');

// Take screenshot
await page.screenshot({ path: 'netlify-screenshot.png', fullPage: true });

// Extract page content for analysis
const content = {
title: await page.title(),
headings: await page.evaluate(() => {
const h1s = Array.from(document.querySelectorAll('h1')).map(h => h.textContent.trim());
const h2s = Array.from(document.querySelectorAll('h2')).map(h => h.textContent.trim());
const h3s = Array.from(document.querySelectorAll('h3')).map(h => h.textContent.trim());
return { h1: h1s, h2: h2s, h3: h3s };
}),
mainText: await page.evaluate(() => {
// Get text from main content areas
const main = document.querySelector('main') || document.body;
const paragraphs = Array.from(main.querySelectorAll('p')).map(p => p.textContent.trim()).filter(text => text.length > 50);
return paragraphs.slice(0, 10); // First 10 substantial paragraphs
}),
navigation: await page.evaluate(() => {
const navItems = Array.from(document.querySelectorAll('nav a, header a')).map(a => a.textContent.trim()).filter(text => text.length > 0);
return [...new Set(navItems)]; // Remove duplicates
})
};

console.log('Screenshot taken: netlify-screenshot.png');
console.log('Page analysis:');
console.log(JSON.stringify(content, null, 2));

await browser.close();
return content;
}

takeScreenshot().catch(console.error);