Fetcher + VisualSelector - xPath filter with attribute filter was breaking the element finder

pull/1234/head
dgtlmoon 2 years ago committed by GitHub
parent b76148a0f4
commit e970fef991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -174,10 +174,23 @@ if (include_filters.length) {
} }
if (q) { if (q) {
bbox = q.getBoundingClientRect(); // #1231 - IN the case XPath attribute filter is applied, we will have to traverse up and find the element.
console.log("xpath_element_scraper: Got filter element, scroll from top was "+scroll_y) if (q.hasOwnProperty('getBoundingClientRect')) {
} else { bbox = q.getBoundingClientRect();
console.log("xpath_element_scraper: filter element "+f+" was not found"); console.log("xpath_element_scraper: Got filter element, scroll from top was " + scroll_y)
} else {
try {
// Try and see we can find its ownerElement
bbox = q.ownerElement.getBoundingClientRect();
console.log("xpath_element_scraper: Got filter by ownerElement element, scroll from top was " + scroll_y)
} catch (e) {
console.log("xpath_element_scraper: error looking up ownerElement")
}
}
}
if(!q) {
console.log("xpath_element_scraper: filter element " + f + " was not found");
} }
if (bbox && bbox['width'] > 0 && bbox['height'] > 0) { if (bbox && bbox['width'] > 0 && bbox['height'] > 0) {

Loading…
Cancel
Save