Skip to content

#

This is the latest development version

Some features documented on this page may not yet be available in the published stable version.

absent: Condition[Element] = Condition('is absent in DOM', present.not_) module-attribute #

Deprecated 'is absent' condition. Use absent_in_dom instead.

absent_in_dom: Condition[Element] = Condition('is absent in DOM', present_in_dom.not_) module-attribute #

blank: Condition[Element] = Match('is blank', actual=lambda element: ('value', webelement.get_attribute('value')) if (webelement := element.locate()) and webelement.tag_name == 'input' else ('text', webelement.text), by=lambda actual_desc_and_result: not actual_desc_and_result[1], _describe_actual_result=lambda actual_desc_and_result: f'actual {actual_desc_and_result[0]}: {actual_desc_and_result[1]}') module-attribute #

Asserts that element is blank, i.e. has empty value if is an element or empty text otherwise.

Is similar to the experimental 4-in-1 [_empty][selene.core.match._empty] condition, works only for singular elements: if they are a value-based elements (like inputs and textarea) then it checks for empty value, if they are text-based elements then it checks for empty text content.

The _empty condition works same but if applied to collection then will assert that it has size 0. And when applied to "form" element, then will check for all form "value-like" inputs to be empty. Hence, the blank condition is more precise, while empty is more general. Because of its generality, the empty condition can be easier to remember, but can lead to some kind of confusion when applied to both element and collection in same test.

checked: Condition[Element] = native_property('checked').value(True) module-attribute #

clickable: Condition[Element] = visible.and_(enabled) module-attribute #

disabled: Condition[Element] = enabled.not_ module-attribute #

empty: Condition[Collection] = Match('is empty', __is_empty, by=predicate.is_truthy) module-attribute #

Deprecated 'is empty' collection condition. Use size(0) instead.

enabled: Condition[Element] = Match('is enabled', by=lambda element: element.locate().is_enabled()) module-attribute #

existing: Condition[Element] = Match('is present in DOM', by=__deprecated_is_existing, _falsy_exceptions=(AssertionError, NoSuchElementException)) module-attribute #

Deprecated 'is existing' condition. Use present_in_dom instead.

hidden: Condition[Element] = Condition('is hidden', visible.not_) module-attribute #

hidden_in_dom: Condition[Element] = present_in_dom.and_(visible.not_) module-attribute #

present: Condition[Element] = Match('is present in DOM', by=lambda element: fp.thread(element, fp.with_warn('be.present is deprecated, use be.present_in_dom instead', DeprecationWarning), lambda element: element.locate() is not None), _falsy_exceptions=(AssertionError, NoSuchElementException)) module-attribute #

Deprecated 'is present' condition. Use present_in_dom instead.

present_in_dom: Condition[Element] = Match('is present in DOM', actual=lambda element: element.locate(), by=lambda webelement: webelement is not None, _describe_actual_result=lambda webelement: f'actual html element: {webelement.get_attribute('outerHTML')}' if not appium_tools._is_mobile_element(webelement) else str(webelement), _falsy_exceptions=(AssertionError, NoSuchElementException)) module-attribute #

selected: Condition[Element] = Match('is selected', by=lambda element: element.locate().is_selected()) module-attribute #

visible: Condition[Element] = Match('is visible', actual=lambda element: element.locate(), by=lambda actual: actual.is_displayed(), _describe_actual_result=lambda actual: f'actual html element: {actual.get_attribute('outerHTML')}' if not appium_tools._is_mobile_element(actual) else str(actual), _falsy_exceptions=(AssertionError, NoSuchElementException)) module-attribute #

js #

size #

Bases: Match[Union[Collection, Browser, Element]]

or_less: Condition[Collection] property #

or_more: Condition[Collection] property #

tabs_number #

Bases: Match[Browser]

or_less: Condition[Browser] property #

or_more: Condition[Browser] property #

text_pattern #

Bases: Condition[Element]

ignore_case property #

where_flags(flags) #

attribute(name, _inverted=False) #

browser_has_js_returned(expected, script, *args) #

css_class(name, _inverted=False) #

css_property(name, _inverted=False) #

exact_text(expected, _ignore_case=False, _inverted=False) #

exact_texts(*expected, _ignore_case=False, _inverted=False) #

native_property(name, _inverted=False) #

script_returned(expected, script, *args) #

size_greater_than(expected, _inverted=False) #

size_greater_than_or_equal(expected, _inverted=False) #

size_less_than(expected, _inverted=False) #

size_less_than_or_equal(expected, _inverted=False) #

tabs_number_greater_than(expected, _inverted=False) #

tabs_number_greater_than_or_equal(expected, _inverted=False) #

tabs_number_less_than(expected, _inverted=False) #

tabs_number_less_than_or_equal(expected, _inverted=False) #

tag(expected, _name='has tag', _by=predicate.equals) #

tag_containing(expected) #

text_containing(expected, _ignore_case=False, _inverted=False) #

texts(*expected, _ignore_case=False, _inverted=False) #

title(expected, _name='has title', _by=predicate.equals, _inverted=False) #

title_containing(expected, _inverted=False) #

url(expected, _name='has url', _by=predicate.equals, _inverted=False) #

url_containing(expected, _inverted=False) #

value(expected, _inverted=False) #

value_containing(expected, _inverted=False) #

values(*expected, _inverted=False) #

values_containing(*expected, _inverted=False) #