@browserless/agent 14.0.2 → 14.0.3
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 +2 -2
- package/src/snapshot.js +6 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/agent",
|
|
3
3
|
"description": "Drive a Puppeteer page toward a natural-language goal using finite decisions.",
|
|
4
4
|
"homepage": "https://browserless.js.org",
|
|
5
|
-
"version": "14.0.
|
|
5
|
+
"version": "14.0.3",
|
|
6
6
|
"main": "src",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"types": "src/index.d.ts",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "f26f8ff96f57c2f2a848837097b560bd25ddd78a"
|
|
63
63
|
}
|
package/src/snapshot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* global location, scrollX, scrollY, innerWidth, innerHeight */
|
|
1
|
+
/* global HTMLElement, location, scrollX, scrollY, innerWidth, innerHeight */
|
|
2
2
|
// Adapted from browser-use/jev-ultrafast snapshot.js (MIT). See README.md.
|
|
3
3
|
module.exports = function snapshot () {
|
|
4
4
|
return (() => {
|
|
@@ -169,6 +169,8 @@ module.exports = function snapshot () {
|
|
|
169
169
|
.filter(safe)
|
|
170
170
|
.map(e => [identity(e), e.value, e.checked, e.selectedIndex, e.disabled, e.readOnly])
|
|
171
171
|
]
|
|
172
|
+
// A named form control shadows the form's own innerText property.
|
|
173
|
+
const readInnerText = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText').get
|
|
172
174
|
cache.guard = e => {
|
|
173
175
|
if (!e?.isConnected || !visibleNow(e)) return null
|
|
174
176
|
const scope =
|
|
@@ -195,7 +197,9 @@ module.exports = function snapshot () {
|
|
|
195
197
|
])
|
|
196
198
|
: null,
|
|
197
199
|
e.getAttribute('href'),
|
|
198
|
-
scope
|
|
200
|
+
(scope instanceof HTMLElement
|
|
201
|
+
? readInnerText.call(scope).slice(0, 6000)
|
|
202
|
+
: scope?.textContent?.slice(0, 6000)) || '',
|
|
199
203
|
[...(cache.closest(e, 'form')?.querySelectorAll('input,textarea,select') || [])]
|
|
200
204
|
.filter(safe)
|
|
201
205
|
.map(field => [
|