-
Notifications
You must be signed in to change notification settings - Fork 0
/
session-buddy-export.js
executable file
·37 lines (30 loc) · 1.38 KB
/
session-buddy-export.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const chromeLauncher = require('chrome-launcher');
const axios = require('axios');
const puppeteer = require('puppeteer-core');
const DELAY = 1000;
(async () => {
const chrome = await chromeLauncher.launch({
chromeFlags: ['--headless']
});
const response = await axios.get(`http://localhost:9222/json/version`);
const { webSocketDebuggerUrl } = response.data;
const browser = await puppeteer.connect({
browserWSEndpoint: webSocketDebuggerUrl
});
const page = await browser.newPage();
await page.waitForTimeout(DELAY);
await page.goto('chrome-extension://edacconmaakjimmfgnblocblbcdcpbko/main.html');
await page.click('#btnConfigure'); // Settings button
await page.click('#menuItemExport'); // Export button
await page.click('#tabGroup_tab_ExportHTML'); // HTML button
await page.waitForTimeout(DELAY);
await page.click('#sessionExport_Scope'); // Session scope dropdown button
await page.waitForTimeout(DELAY);
await page.select('#sessionExport_Scope', 'all'); // Set option value to 'all'
await page.waitForTimeout(DELAY);
const sessionExportText = await page.$eval('#sessionExportText', textarea => textarea.value);
console.log(sessionExportText);
await page.close();
browser.disconnect();
await chrome.kill();
})();