异步获取元素的脚本库 有问
```async function selectPage() {
const elmGetter = new ElementGetter();
//let select = document.querySelectorAll("#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-dropdown > ul.weu-select-dropdown-list");
//let select50 = document.querySelector("#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-dropdown > ul.weu-select-dropdown-list > li:nth-child(6)");
//let isSelect = document.querySelector("#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-selection > input");
let = await elmGetter.get("#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-dropdown > ul.weu-select-dropdown-list > li:nth-child(6)",
"#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-selection > input")
if (isSelect.value != '50') {
console.log(1);
select50.click();
}
}
```
报错:Uncaught (in promise) TypeError: parent.querySelector is not a function
是不是不接收这样的节点参数啊? 可以直接去库下面提问?
https://scriptcat.org/script-show-page/513/issue let = await elmGetter.get([
"#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-dropdown > ul.weu-select-dropdown-list > li:nth-child(6)",
"#root > div > div > div > div.weu-card.weu-card-bordered > div > div.page-ctn.fiex-footer > ul > div > div > div > div.weu-select-selection > input"
]);
要得到元素数组,第一个参数必须是选择器数组,你漏了方括号。
反馈也可以直接回帖:https://bbs.tampermonkey.net.cn/thread-2726-1-1.html
页:
[1]