Skip to content

find_all returns before waiting for a later screenshot match #71

Description

@breken-ai

Describe the bug

DesktopBot.find_all returns immediately when its first screenshot contains no match, even if waiting_time has not expired. The loop checks if not eles, but locate_all_opencv returns a generator, and an empty generator object is truthy. The retry path is skipped and the call returns an empty list rather than trying a later screenshot. The current main branch at 9d5deaa89520c6e4cec61248f2c0c71931160866 reproduces this using a stubbed screenshot sequence.

Expected behavior

find_all should keep checking screenshots until it finds matches or the configured waiting_time is exhausted.

Steps to Reproduce

  1. Call DesktopBot.find_all with a positive waiting_time.
  2. Stub get_screenshot to return two images without the target, followed by an image with the target.
  3. Observe that main returns [] after the first screenshot instead of finding the later target.

The regression test on existing PR #69 exercises this sequence without a physical screen.

Possible Solution

Materialize the locate_all_opencv generator before checking whether it contains matches, so an empty result continues the wait loop.

My Platform

Observed on repository main at 9d5deaa89520c6e4cec61248f2c0c71931160866; reproduction uses a stubbed screenshot sequence and does not require a physical display. Exact first affected package release is not established.

Additional context

This ticket is being filed to track already-open PR #69, which predates it, and make the contribution issue reference explicit. Issue #50 covers duplicate detections in find_all, not the wait/retry behavior described here.

This contribution was prepared with AI assistance by breken-ai.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions