- fixed [206 – "after manually quitting, setting a new driver fails"](https://github.com/yashaka/selene/issues/206)
- fixed `have.texts` when actual collection has bigger size than actual
- added (yet marked with "experimental" warning)
- `element_by_its`
- `filtered_by_their`
- ... see code examples below:
given
.result
.result-title
.result-url
.result-snippet
in addition to
results = browser.all('.result')
results.element_by(lambda result: have.text('browser tests in python')(
result.element('.result-title')))\
.element('.result-url').click()
you can now write:
results.element_by_its('.result-title', have.text('browser tests in python'))
.element('.result-url').click()
results.filtered_by_their('.result-title', have.text('python'))
.should(have.size(...))
or even
class result:
def __init__(self, element):
self.element = element
self.title = self.element.element('.result-title')
self.url = self.element.element('.result-url')
result(results.element_by_its(lambda it: result(it).title, have.text('browser tests in python')))\
.url.click()
it's yet marked as experimental because probably it would be enough
to make it possible to accept callable[[element], bool] in element_by to allow:
results.element_by(
lambda it: it.element('.result-title').matching(have.text('browser tests in python')))
.element('.result-url').click()
moreover... if failed, the error becomes weird if using lambdas:
timed out after 4s, while waiting for:
browser.all(('css selector', '.result')).element_by(<function collection.element_by_its.<locals>.<lambda> at 0x10df67f28>).element(('css selector', '.result-url')).click
reason: assertionerror: cannot find element by condition «<function collection.element_by_its.<locals>.<lambda> at 0x10df67f28>» from webelements collection:
-