Skip to content

Commit

Permalink
fix(parser): fix traverse selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
D4Vinci committed Jan 30, 2025
1 parent a8d475a commit a6fd25f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scrapling/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def find_by_text(
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:
Expand Down Expand Up @@ -933,7 +933,7 @@ def find_by_regex(
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):
Expand Down

0 comments on commit a6fd25f

Please # to comment.