39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
const { chromium } = require('playwright');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const ctx = await browser.newContext();
|
|
const page = await ctx.newPage();
|
|
|
|
await page.goto('http://localhost:5173/context/daily-log');
|
|
await page.waitForTimeout(4000);
|
|
|
|
const result = await page.evaluate(() => {
|
|
const chip = document.querySelector('[data-task-new]');
|
|
if (!chip) {
|
|
return {
|
|
noChip: true,
|
|
divs: Array.from(document.querySelectorAll('.markdown-content')).map(e => ({
|
|
cls: e.className.slice(0, 60),
|
|
ds: Object.fromEntries(Object.entries(e.dataset))
|
|
}))
|
|
};
|
|
}
|
|
const gp = chip.parentElement && chip.parentElement.parentElement;
|
|
const cl = chip.closest('[data-history-entry-id]');
|
|
return {
|
|
chipDs: Object.fromEntries(Object.entries(chip.dataset)),
|
|
gpClass: gp ? gp.className.slice(0, 60) : null,
|
|
gpDs: gp ? Object.fromEntries(Object.entries(gp.dataset)) : null,
|
|
closest: cl ? { tag: cl.tagName, id: cl.dataset.historyEntryId } : null,
|
|
divs: Array.from(document.querySelectorAll('.markdown-content')).map(e => ({
|
|
cls: e.className.slice(0, 60),
|
|
ds: Object.fromEntries(Object.entries(e.dataset))
|
|
}))
|
|
};
|
|
});
|
|
|
|
console.log(JSON.stringify(result, null, 2));
|
|
await browser.close();
|
|
})();
|