xinliushi 发表于 2024-12-6 00:27:37

后台脚本获取到的ResponseText Html文本转换DomParser后获取不到类名

!(data/attachment/forum/202412/06/002405zluh2su4rzq7u3xj.png)
!(data/attachment/forum/202412/06/002439iz2lerg2eizm2vvi.png)
!(data/attachment/forum/202412/06/002504qpv0r4lr9vv9lz22.png)

steven026 发表于 2024-12-6 00:27:38

https://docs.scriptcat.org/docs/dev/api/#gm_log-
```ts
declare function GM_log(message: string, level?: GM_Types.LoggerLevel): any;
declare namespace GM_Types {
type LoggerLevel = "debug" | "info" | "warn" | "error";
}
```

GM_log只能输出字符串,不能输出元素
你应该用
```js
GM_log(ele.textContent)
```

xinliushi 发表于 2024-12-6 00:32:33

https://bbs.tampermonkey.net.cn/thread-973-1-1.html
根据此链接在控制台使用DomParser转换没问题,普通脚本也没问题,后台脚本出现了这种情况

xinliushi 发表于 2024-12-6 00:35:22

普通脚本正常
!(data/attachment/forum/202412/06/003459urrj4crv642rr41c.png)
!(data/attachment/forum/202412/06/003435vlajalzaj4ahvhlw.png)

xinliushi 发表于 2024-12-6 09:31:33

steven026 发表于 2024-12-6 00:27
https://docs.scriptcat.org/docs/dev/api/#gm_log-
```ts
declare function GM_log(message: string,...

谢谢佬,是这个问题,已经解决了
页: [1]
查看完整版本: 后台脚本获取到的ResponseText Html文本转换DomParser后获取不到类名