update readme. ensure children(recursive=True) returns a list

This commit is contained in:
UltrafunkAmsterdam 2022-11-29 18:19:28 +01:00
parent e4d75cbdd0
commit e33312535e
2 changed files with 28 additions and 1 deletions

View File

@ -11,6 +11,33 @@ Automatically downloads the driver binary and patches it.
* Works also on Brave Browser and many other Chromium based browsers, some tweaking
* Python 3.6++**
### 3.2.0 ###
* added an example containing some typical webdriver code, answers to commonly asked questions,
pitfalls + showcasing some tricks to ditch the need for multithreading.
###[>>>> example code here <<<<](https://github.com/ultrafunkamsterdam/undetected-chromedriver/blob/3.2.0/undetected_chromedriver/example.py)
* added WebElement.click_safe() method, which you can try in case you get detected
after clicking a link. This is not guaranteed t o work.
* added WebElement.children(self, tag=None, recursive=False)
to easily get/find child nodes.
example:
```
body = driver.find_element('tag name', 'body')
# get the 6th child (any tag) of body, and grab all img's within (recursive).
images = body.children()[6].children('img', True)
srcs = list(map(lambda _:_.attrs.get('src'))
```
* added example.py where i can point people at
when asking silly questions
(no, its actually quite cool, everyone should see it)
* some refactoring
### 3.1.6 ###
### still passing strong ###

View File

@ -81,4 +81,4 @@ def _recursive_children(element, tag: str = None, _results=None):
else:
results.add(element)
results |= _recursive_children(element, tag, results)
return results
return list(results)