-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshot.js
More file actions
30 lines (26 loc) · 1.08 KB
/
Copy pathscreenshot.js
File metadata and controls
30 lines (26 loc) · 1.08 KB
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
const { chromium } = require('playwright-core');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 390, height: 844 } });
await page.goto('http://localhost:5175');
await page.waitForTimeout(2000);
// Click Recommend tab (bottom nav, 3rd item)
const tabs = await page.locator('nav button, nav a, [role="tablist"] button, [role="tablist"] a').all();
if (tabs.length >= 3) {
await tabs[1].click();
} else {
// fallback: click by text
await page.locator('text=Recommend').nth(1).click();
}
await page.waitForTimeout(3000);
// Click on battery slider track at ~5% position (far left)
const batterySlider = await page.locator('input[type="range"]').nth(1);
const box = await batterySlider.boundingBox();
if (box) {
// Click near the left edge of the slider (5%)
await page.mouse.click(box.x + 20, box.y + box.height / 2);
}
await page.waitForTimeout(3000);
await page.screenshot({ path: 'c:/Users/MXL0RRR/projects/ev/screenshot-rec.png', fullPage: true });
await browser.close();
})();