コード例 #1
0
 def _not(self, negated: Not):
     """Negate resolved values."""
     value = self._resolve(negated.value)
     if not value:
         return [Undefined()]
     else:
         return []
コード例 #2
0
ファイル: test_syntax.py プロジェクト: nadileaf/rpaframework
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()]
コード例 #3
0
ファイル: finder.py プロジェクト: robocorp/rpaframework
    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))
コード例 #4
0
 def __init__(self, finder):
     self.finder = finder
     self._stack = [Undefined()]