def _not(self, negated: Not): """Negate resolved values.""" value = self._resolve(negated.value) if not value: return [Undefined()] else: return []
def test_resolver_not(): def finder(base, locator): if isinstance(locator, PointLocator): return ["somevalue"] if isinstance(locator, ImageLocator): return [] resolver = Resolver(finder) result = resolver.dispatch("not (point:10,10 and image:notexist.png)") assert result == [Undefined()]
def find_elements(self, locator: LocatorType) -> List[Geometry]: """Find all elements defined by locator, and return their positions. :param locator: Locator string Example: .. code-block:: robotframework ${matches}= Find elements image:icon.png FOR ${match} IN @{matches} Log Found icon at ${match.x}, ${match.y} END """ self.logger.info("Resolving locator: %s", locator) if isinstance(locator, (Locator, Region, Point)): return self._find(Undefined(), locator) else: return self._resolver.dispatch(str(locator))
def __init__(self, finder): self.finder = finder self._stack = [Undefined()]