Selene

Latest version: v1.0.2

Safety actively analyzes 631877 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 8 of 16

2.0.0a27

- fixed command.js.type and configuration.type_by_js + element.type

2.0.0a26

- if driver was set like `shared.config.driver = my_custom_driver`
- then it's not mandatory to call `shared.browser.open` first

2.0.0a25

- fixing [172](https://github.com/yashaka/selene/issues/172)
- added `shared.config.set_driver: callable[[], webdriver]`
as alternative to `shared.config.driver: webdriver`
- now if config.set_driver is set - it will be used
to create and reload the driver instance according to your needs
- setting `shared.config.driver = my_driver` is equivalent to setting
then `shared.config.set_driver = lambda: my_driver`
- only `shared.browser.open(url)` now makes `set_driver`
to be triggered on first start and if driver was crashed or quit
- i.e. if driver is crashed
any further action on `shared.browser.element` will crash too
unless you call `shared.browser.open` again
- browser.open will also crash
if you used `shared.config.driver = my_driver` before
- **removed** implementation of "re-creating browser" if shared.config.browser_name was changed
- this should make shared.browser more friendly with appium
- and nevertheless shared.config should be used only "after quit and before open"...

2.0.0a24

- fixed [210](https://github.com/yashaka/selene/issues/210)
- when installing using pip -- unicodedecodeerror: 'charmap' codec can't decode byte

2.0.0a23

- fixed element.cached to not fail on non-existing element

- fixed conditions that "compare lists" (like "have.exact_texts")
- failed earlier if one collection (expected or actual) was empty

- added logging of webelement outer html to the error message of failed waiting for element
- if actually webelement was found, but something was wrong with it (like hidden or non-interactable)

- improved errors from browser.all.element_by
- TODO: improve for other all.* methods

was:


timed out after 4s, while waiting for:
browser.all(('css selector', 'task-list>li')).element_by(has exact text a).double click
reason: assertionerror: cannot find element by condition «has exact text a» from webelements collection:
[[]]


now:


timed out after 4s, while waiting for:
browser.all(('css selector', 'task-list>li')).element_by(has exact text a).double click

reason: assertionerror:
cannot find element by condition «has exact text a»
among browser.all(('css selector', 'task-list>li'))
actual webelements collection:
[]

2.0.0a22

- 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:


-

Page 8 of 16

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.