textweb 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/browser.js +7 -1
- package/src/cli.js +2 -2
package/package.json
CHANGED
package/src/browser.js
CHANGED
|
@@ -34,7 +34,13 @@ class AgentBrowser {
|
|
|
34
34
|
async navigate(url) {
|
|
35
35
|
if (!this.page) await this.launch();
|
|
36
36
|
this.scrollY = 0;
|
|
37
|
-
|
|
37
|
+
// Use domcontentloaded + a short settle, not networkidle (SPAs never go idle)
|
|
38
|
+
await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
|
|
39
|
+
// Wait for network to settle or 3s max — whichever comes first
|
|
40
|
+
await Promise.race([
|
|
41
|
+
this.page.waitForLoadState('networkidle').catch(() => {}),
|
|
42
|
+
new Promise(r => setTimeout(r, 3000)),
|
|
43
|
+
]);
|
|
38
44
|
return await this.snapshot();
|
|
39
45
|
}
|
|
40
46
|
|
package/src/cli.js
CHANGED
|
@@ -139,7 +139,7 @@ async function render(url, options) {
|
|
|
139
139
|
if (elCount > 0) {
|
|
140
140
|
console.error(`\\nInteractive elements:`);
|
|
141
141
|
for (const [ref, element] of Object.entries(result.elements || {})) {
|
|
142
|
-
console.error(`[${ref}] ${element.
|
|
142
|
+
console.error(`[${ref}] ${element.semantic || element.tag}: ${element.text || '(no text)'}`);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -312,7 +312,7 @@ Interactive Commands:
|
|
|
312
312
|
if (result && Object.keys(result.elements || {}).length > 0) {
|
|
313
313
|
console.log(`Interactive elements (${Object.keys(result.elements || {}).length}):`);
|
|
314
314
|
for (const [ref, element] of Object.entries(result.elements || {})) {
|
|
315
|
-
console.log(`[${ref}] ${element.
|
|
315
|
+
console.log(`[${ref}] ${element.semantic || element.tag}: ${element.text || '(no text)'}`);
|
|
316
316
|
}
|
|
317
317
|
} else {
|
|
318
318
|
console.log('No interactive elements found');
|