Spaces:
No application file
No application file
Update browser_automation_ui.html
Browse files- browser_automation_ui.html +4 -11
browser_automation_ui.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
| 66 |
<body>
|
| 67 |
<div class="container">
|
| 68 |
<header class="header">
|
| 69 |
-
<h1>Headless Browser</h1>
|
| 70 |
<p>Playwright 路 Selenium 路 Screenshot 路 Scraping</p>
|
| 71 |
</header>
|
| 72 |
|
|
@@ -240,20 +240,13 @@ All endpoints return { ok: true/false, data, error }
|
|
| 240 |
|
| 241 |
async function takeScreenshot () {
|
| 242 |
const out = await api('/browser/screenshot');
|
| 243 |
-
alert("Your message here");
|
| 244 |
-
|
| 245 |
-
const preview = document.getElementById('shotPreview');
|
| 246 |
-
const downloadBtn = document.getElementById('downloadBtn');
|
| 247 |
-
const response = document.getElementById('shotResp');
|
| 248 |
|
| 249 |
// Separate the big base64 string so we don鈥檛 dump it in the response box
|
| 250 |
const { b64, ...meta } = out;
|
| 251 |
document.getElementById('shotResp').textContent = JSON.stringify(meta, null, 2);
|
| 252 |
-
|
| 253 |
-
const dl = document.getElementById('downloadBtn');
|
| 254 |
-
dl.style.display = 'inline-flex';
|
| 255 |
|
| 256 |
if (b64) {
|
|
|
|
| 257 |
const dataUrl = `data:image/png;base64,${b64}`;
|
| 258 |
|
| 259 |
// Show thumbnail
|
|
@@ -262,9 +255,9 @@ All endpoints return { ok: true/false, data, error }
|
|
| 262 |
//'<div style="padding: 20px; background: #e9ecef; border-radius: 4px; text-align: center;">馃摳 Screenshot captured!</div>';
|
| 263 |
|
| 264 |
// Wire up & reveal the download button
|
| 265 |
-
|
| 266 |
//dl.href = dataUrl;
|
| 267 |
-
|
| 268 |
}
|
| 269 |
}
|
| 270 |
|
|
|
|
| 66 |
<body>
|
| 67 |
<div class="container">
|
| 68 |
<header class="header">
|
| 69 |
+
<h1>Headless Browser V1.0</h1>
|
| 70 |
<p>Playwright 路 Selenium 路 Screenshot 路 Scraping</p>
|
| 71 |
</header>
|
| 72 |
|
|
|
|
| 240 |
|
| 241 |
async function takeScreenshot () {
|
| 242 |
const out = await api('/browser/screenshot');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
// Separate the big base64 string so we don鈥檛 dump it in the response box
|
| 245 |
const { b64, ...meta } = out;
|
| 246 |
document.getElementById('shotResp').textContent = JSON.stringify(meta, null, 2);
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
if (b64) {
|
| 249 |
+
alert("Your message here");
|
| 250 |
const dataUrl = `data:image/png;base64,${b64}`;
|
| 251 |
|
| 252 |
// Show thumbnail
|
|
|
|
| 255 |
//'<div style="padding: 20px; background: #e9ecef; border-radius: 4px; text-align: center;">馃摳 Screenshot captured!</div>';
|
| 256 |
|
| 257 |
// Wire up & reveal the download button
|
| 258 |
+
const dl = document.getElementById('downloadBtn');
|
| 259 |
//dl.href = dataUrl;
|
| 260 |
+
dl.style.display = 'inline-flex';
|
| 261 |
}
|
| 262 |
}
|
| 263 |
|