from selene.core import query from selene.core.condition import Condition from selene.core.conditions import ( ElementCondition, CollectionCondition, BrowserCondition, ) from selene.core.entity import Collection, Element, Browser # todo: consider moving to selene.match.element.is_visible, etc... element_is_visible: Condition[Element] = ElementCondition.raise_if_not( 'is visible', lambda element: element().is_displayed() ) element_is_hidden: Condition[Element] = ElementCondition.as_not( element_is_visible, 'is hidden' ) element_is_enabled: Condition[Element] = ElementCondition.raise_if_not( 'is enabled', lambda element: element().is_enabled() ) element_is_disabled: Condition[Element] = ElementCondition.as_not( element_is_enabled ) element_is_clickable: Condition[Element] = element_is_visible.and_( element_is_enabled ) element_is_present: Condition[Element] = ElementCondition.raise_if_not(
# SOFTWARE. import warnings from typing import List, Any from selene.core import query from selene.common import predicate from selene.core.condition import Condition from selene.core.entity import Collection, Element, Browser from selene.core.conditions import ElementCondition, CollectionCondition, BrowserCondition # todo: consider moving to selene.match.element.is_visible, etc... element_is_visible: Condition[Element] = \ ElementCondition.raise_if_not('is visible', lambda element: element().is_displayed()) element_is_hidden: Condition[Element] = \ ElementCondition.as_not(element_is_visible, 'is hidden') element_is_enabled: Condition[Element] = \ ElementCondition.raise_if_not('is enabled', lambda element: element().is_enabled()) element_is_disabled: Condition[Element] = \ ElementCondition.as_not(element_is_enabled) element_is_clickable: Condition[Element] = \ element_is_visible.and_(element_is_enabled) element_is_present: Condition[Element] = \ ElementCondition.raise_if_not('is present in DOM', lambda element: element() is not None) element_is_absent: Condition[Element] = \ ElementCondition.as_not(element_is_present)