Skip to content

Instantly share code, notes, and snippets.

@naosim
Created July 23, 2024 20:33
Show Gist options
  • Save naosim/4df77acf12c95065f4f06482c9e25b91 to your computer and use it in GitHub Desktop.
Save naosim/4df77acf12c95065f4f06482c9e25b91 to your computer and use it in GitHub Desktop.
起動中のchromeでカレンダーを表示してスクショする
// chromeを起動する
// "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=remote-profile
import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';
// Launch the browser and open a new blank page
// const browser = await puppeteer.launch();
const browser = await puppeteer.connect({
browserURL: 'http://127.0.0.1:9222',
defaultViewport: {
width: 1000,
height: 1000
}
});
const page = await browser.newPage();
// Navigate the page to a URL.
await page.goto('https://calendar.google.com/calendar?authuser=0');
// // Set screen size.
// await page.setViewport({width: 1080, height: 1024});
// // Type into search box.
const targetUsers = [];
for(const targetUser of targetUsers) {
await page.locator('input[type="text"][role="combobox"][aria-label="ユーザーを検索"]').fill(targetUser);
await page.keyboard.press('Enter');
}
page.screenshot({ path: 'screenshot.png', fullPage: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment