mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-18 01:26:59 +08:00
More XPaths Bug Fix
This commit is contained in:
parent
f50b08e9c4
commit
7c0ab0e519
Binary file not shown.
BIN
ElectronJS/EasySpider_zh.crx
Normal file
BIN
ElectronJS/EasySpider_zh.crx
Normal file
Binary file not shown.
@ -57,13 +57,13 @@ export function getElementXPaths(element, parentElement = document.body) {
|
|||||||
paths.push(pre_xpath + `id("${element.id}")`);
|
paths.push(pre_xpath + `id("${element.id}")`);
|
||||||
}
|
}
|
||||||
if (element.className) {
|
if (element.className) {
|
||||||
paths.push(pre_xpath + "//" + element.tagName + "[@class='" + element.className + "']");
|
paths.push(pre_xpath + "//" + element.tagName.toLowerCase() + "[@class='" + element.className + "']");
|
||||||
}
|
}
|
||||||
if (element.name) {
|
if (element.name) {
|
||||||
paths.push(pre_xpath + "//" + element.tagName + "[@name='" + element.name + "']");
|
paths.push(pre_xpath + "//" + element.tagName.toLowerCase() + "[@name='" + element.name + "']");
|
||||||
}
|
}
|
||||||
if (element.alt) {
|
if (element.alt) {
|
||||||
paths.push(pre_xpath + "//" + element.tagName + "[@alt='" + element.alt + "']");
|
paths.push(pre_xpath + "//" + element.tagName.toLowerCase() + "[@alt='" + element.alt + "']");
|
||||||
}
|
}
|
||||||
paths.push(getAbsoluteXPathWithReverseIndex(element));
|
paths.push(getAbsoluteXPathWithReverseIndex(element));
|
||||||
console.log("ALL PATHS: " + paths);
|
console.log("ALL PATHS: " + paths);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user