From a6fd25f64c3a8eddd305458bb378d0682b4c365d Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Fri, 31 Jan 2025 01:57:19 +0200 Subject: [PATCH] fix(parser): fix traverse selectors --- scrapling/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapling/parser.py b/scrapling/parser.py index d3ec663..eac0d64 100644 --- a/scrapling/parser.py +++ b/scrapling/parser.py @@ -897,7 +897,7 @@ class Adaptor(SelectorsGeneration): text = text.lower() # This selector gets all elements with text content - for node in self.__handle_elements(self._root.xpath('//*[normalize-space(text())]')): + for node in self.__handle_elements(self._root.xpath('.//*[normalize-space(text())]')): """Check if element matches given text otherwise, traverse the children tree and iterate""" node_text = node.text if clean_match: @@ -933,7 +933,7 @@ class Adaptor(SelectorsGeneration): results = Adaptors([]) # This selector gets all elements with text content - for node in self.__handle_elements(self._root.xpath('//*[normalize-space(text())]')): + for node in self.__handle_elements(self._root.xpath('.//*[normalize-space(text())]')): """Check if element matches given regex otherwise, traverse the children tree and iterate""" node_text = node.text if node_text.re(query, check_match=True, clean_match=clean_match, case_sensitive=case_sensitive):