re-fix children so it returns a list

This commit is contained in:
Leon 2022-12-14 21:22:22 +00:00 committed by GitHub
parent 1e8e83f6ae
commit ab6c54df6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -18,8 +18,8 @@ class WebElement(selenium.webdriver.remote.webelement.WebElement):
if tag:
script += ".filter( node => node.tagName === '%s')" % tag.upper()
if recursive:
return _recursive_children(self, tag)
return self._parent.execute_script(script, self)
return list(_recursive_children(self, tag))
return list(self._parent.execute_script(script, self))
class UCWebElement(WebElement):
@ -81,4 +81,4 @@ def _recursive_children(element, tag: str = None, _results=None):
else:
results.add(element)
results |= _recursive_children(element, tag, results)
return list(results)
return results